From 0ecf7d3540f73e1a19cc32e4afe9f2f8d676799c Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Mon, 13 Mar 2023 21:50:07 +0800 Subject: [PATCH] KeepDockOnPrimaryHead: fix drawer direction When that option is on, swapping drawer does not always mean swapping drawer direction. For example if drawer is on the left side of the second head and moving to the left side of the first head, the direction should be the same. --- src/dock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dock.c b/src/dock.c index a0c4f2dd..6eed7101 100644 --- a/src/dock.c +++ b/src/dock.c @@ -4,6 +4,7 @@ * * Copyright (c) 1997-2003 Alfredo K. Kojima * Copyright (c) 1998-2003 Dan Pascu + * Copyright (c) 2009-2023 Window Maker Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -3038,7 +3039,6 @@ void wDockSwap(WDock *dock) WAppIcon *btn; int x, i; - x = getDockXPosition(scr, dock->on_right_side); swapDrawers(scr, x); dock->x_pos = x; @@ -4619,7 +4619,10 @@ static void swapDrawer(WDock *drawer, int new_x) ai = drawer->icon_array[i]; if (ai == NULL) continue; - ai->xindex *= -1; /* so A B C becomes C B A */ + if (drawer->on_right_side) + ai->xindex = -abs(ai->xindex); + else + ai->xindex = abs(ai->xindex); ai->x_pos = new_x + ai->xindex * ICON_SIZE; /* Update drawer's tile */ -- 2.11.4.GIT