This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via 2f33b3c2bc42ee88e6b6055a2f41367c296ef481 (commit)
from fd19456d66fc29d6200bad93db1db1c219b3805c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/wmaker-crm.git/commit/2f33b3c2bc42ee88e6b6055a2f41367c296ef481
commit 2f33b3c2bc42ee88e6b6055a2f41367c296ef481
Author: Doug Torrance <[email protected]>
Date: Sat Jan 16 00:22:34 2016 -0500
wmaker: Maintain sorting of windows by workspace in switch menu.
Previously, this sorting failed when one window was moved to another
workspace.
This fixes Debian bug #280851 [1].
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=280851
diff --git a/src/switchmenu.c b/src/switchmenu.c
index a614e4f..3106595 100644
--- a/src/switchmenu.c
+++ b/src/switchmenu.c
@@ -149,27 +149,22 @@ void OpenSwitchMenu(WScreen * scr, int x, int y, int
keyboard)
static int menuIndexForWindow(WMenu * menu, WWindow * wwin, int old_pos)
{
- int idx;
+ int idx, move_down;
if (menu->entry_no <= old_pos)
return -1;
-#define WS(i) ((WWindow*)menu->entries[i]->clientdata)->frame->workspace
- if (old_pos >= 0) {
- if (WS(old_pos) >= wwin->frame->workspace
- && (old_pos == 0 || WS(old_pos - 1) <=
wwin->frame->workspace)) {
- return old_pos;
- }
- }
-#undef WS
-
- for (idx = 0; idx < menu->entry_no; idx++) {
+ for (idx = 0, move_down = 0; idx < menu->entry_no; idx++) {
WWindow *tw = (WWindow *) menu->entries[idx]->clientdata;
- if (!IS_OMNIPRESENT(tw)
- && tw->frame->workspace > wwin->frame->workspace) {
- break;
- }
+ /* Is the window moving down in the menu? If so, we'll need to
+ adjust its new index by 1. */
+ if (tw == wwin)
+ move_down = 1;
+
+ if (IS_OMNIPRESENT(tw) || (tw != wwin &&
+ tw->frame->workspace >=
wwin->frame->workspace))
+ return idx - move_down;
}
return idx;
@@ -215,7 +210,7 @@ void UpdateSwitchMenu(WScreen * scr, WWindow * wwin, int
action)
if (IS_OMNIPRESENT(wwin))
idx = -1;
else {
- idx = menuIndexForWindow(switchmenu, wwin, -1);
+ idx = menuIndexForWindow(switchmenu, wwin, 0);
}
entry = wMenuInsertCallback(switchmenu, idx, t, focusWindow,
wwin);
-----------------------------------------------------------------------
Summary of changes:
src/switchmenu.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].