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

Use actual x position of dock when saving state

Previously, we either saved it as 0 or -ICON_SIZE, and then adjusted
it depending on the screen width when restoring the state.

But since the introduction of the "KeepDockOnPrimaryHead" option, the
state-restoring code has changed so that the dock will go on the left if the
x-coordinate of the position in WMState is to the left of the midpoint
of the screen and on the right otherwise.  But previously (unless the
user manually set the value in WMState) this would always send the
dock to the left, even if it had been on the right, since the x-coordinate
automatically saved to WMState in this case was negative.

We simplify things by saving the actual x position of the dock to WMState.
This commit is contained in:
Torrance, Douglas
2023-01-20 02:45:56 +00:00
committed by Carlos R. Mafra
parent 10c36d244e
commit f6165d6e80

View File

@@ -1568,7 +1568,7 @@ static WMPropList *dockSaveState(WDock *dock)
WMPutInPLDictionary(dock_state, key, list);
WMReleasePropList(key);
snprintf(buffer, sizeof(buffer), "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0), dock->y_pos);
snprintf(buffer, sizeof(buffer), "%i,%i", dock->x_pos, dock->y_pos);
value = WMCreatePLString(buffer);
WMPutInPLDictionary(dock_state, dPosition, value);
WMReleasePropList(value);