From f6165d6e80c1017e2cf20ace7303d627b8da647a Mon Sep 17 00:00:00 2001 From: "Torrance, Douglas" Date: Fri, 20 Jan 2023 02:45:56 +0000 Subject: [PATCH] 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. --- src/dock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dock.c b/src/dock.c index f757a344..30504121 100644 --- a/src/dock.c +++ b/src/dock.c @@ -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);