Add "Center" window placement strategy

Center strategy: try to put window at the center of the usable area. If
window would overlap with existing windows, fall back to "Auto"
placement strategy.

It's very useful for fresh workplaces.
This commit is contained in:
Yuri Karaban authored and Carlos R. Mafra committed 2012-06-10 18:25:47 +01:00
1 parent 1a594de74e
commit 9d3d34599f
4 files changed
+53 -2

No files matched your search

+5 -1
View File
@@ -82,7 +82,8 @@ static char *placements[] = {
"random",
"manual",
"cascade",
"smart"
"smart",
"center"
};
static void sliderCallback(WMWidget * w, void *data)
@@ -151,6 +152,8 @@ static int getPlacement(char *str)
return 3;
else if (strcasecmp(str, "smart") == 0)
return 4;
else if (strcasecmp(str, "center") == 0)
return 5;
else
wwarning(_("bad option value %s in WindowPlacement. Using default value"), str);
return 0;
@@ -266,6 +269,7 @@ static void createPanel(Panel * p)
WMAddPopUpButtonItem(panel->placP, _("Manual"));
WMAddPopUpButtonItem(panel->placP, _("Cascade"));
WMAddPopUpButtonItem(panel->placP, _("Smart"));
WMAddPopUpButtonItem(panel->placP, _("Center"));
panel->porigL = WMCreateLabel(panel->placF);
WMResizeWidget(panel->porigL, 120, 32);