From 0e14789acae7d11d85a7130838a37e151eeaeaf9 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 13 May 2009 15:26:50 -0400 Subject: [PATCH] Fix Alt-Shift-Tab to not skip some windows The % operator doesn't do the expected thing with negative numbers. --- src/shell-alttab.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/shell-alttab.c b/src/shell-alttab.c index 0924f310f..d36967312 100644 --- a/src/shell-alttab.c +++ b/src/shell-alttab.c @@ -148,7 +148,10 @@ shell_alt_tab_handler_forward (MetaAltTabHandler *handler) { ShellAltTabHandler *sth = SHELL_ALT_TAB_HANDLER (handler); - sth->selected = (sth->selected + 1) % sth->windows->len; + if (sth->selected == sth->windows->len - 1) + sth->selected = 0; + else + sth->selected++; g_object_notify (G_OBJECT (handler), "selected"); } @@ -157,7 +160,10 @@ shell_alt_tab_handler_backward (MetaAltTabHandler *handler) { ShellAltTabHandler *sth = SHELL_ALT_TAB_HANDLER (handler); - sth->selected = (sth->selected - 1) % sth->windows->len; + if (sth->selected == 0) + sth->selected = sth->windows->len - 1; + else + sth->selected--; g_object_notify (G_OBJECT (handler), "selected"); }