1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00

Support "KeepDockOnPrimaryHead" when restoring state

We use the new helper function getDockXPosition to determine where
to put the dock.  If WMState gives an x-coordinate less than the
center of the screen, we put it on the left, and otherwise we put it
on the right.
This commit is contained in:
Torrance, Douglas
2023-01-18 11:42:57 +00:00
committed by Carlos R. Mafra
parent d4f5f3ec7f
commit 48d4820dee

View File

@@ -1846,11 +1846,17 @@ WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
dock->x_pos = scr->scr_width - ICON_SIZE;
}
} else {
if (dock->x_pos >= 0) {
dock->x_pos = DOCK_EXTRA_SPACE;
int left, right, midpoint;
left = getDockXPosition(scr, False);
right = getDockXPosition(scr, True);
midpoint = (left + right) / 2;
if (dock->x_pos < midpoint) {
dock->x_pos = left;
dock->on_right_side = 0;
} else {
dock->x_pos = scr->scr_width - DOCK_EXTRA_SPACE - ICON_SIZE;
dock->x_pos = right;
dock->on_right_side = 1;
}
}