From bc61dd71a918f89446f640666b7b73602e3246fb Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 25 Oct 2004 16:16:12 +0000 Subject: Fix the alt-tab order--if the most recently used window is not focused, 2004-10-25 Elijah Newren Fix the alt-tab order--if the most recently used window is not focused, start alt tabbing with that window instead of the one after it (fixes #156251) * src/display.c (find_tab_forward): add a skip_first parameter, (find_tab_backward): add a skip_last parameter, (meta_display_get_tab_next): if a beginning window wasn't given and the focused window isn't the tab chain, don't skip the MRU window --- ChangeLog | 12 ++++++++++++ src/display.c | 36 ++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c6ef76a..77abbd24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-10-25 Elijah Newren + + Fix the alt-tab order--if the most recently used window is not + focused, start alt tabbing with that window instead of the one + after it (fixes #156251) + + * src/display.c (find_tab_forward): add a skip_first parameter, + (find_tab_backward): add a skip_last parameter, + (meta_display_get_tab_next): if a beginning window wasn't given + and the focused window isn't the tab chain, don't skip the MRU + window + 2004-10-25 Elijah Newren * src/screen.c (queue_windows_showing): Revert the diff --git a/src/display.c b/src/display.c index 02797acf..225d6c75 100644 --- a/src/display.c +++ b/src/display.c @@ -3927,16 +3927,20 @@ meta_display_window_has_pending_pings (MetaDisplay *display, static MetaWindow* find_tab_forward (MetaDisplay *display, MetaTabList type, - MetaScreen *screen, + MetaScreen *screen, MetaWorkspace *workspace, - GList *start) + GList *start, + gboolean skip_first) { GList *tmp; g_return_val_if_fail (start != NULL, NULL); g_return_val_if_fail (workspace != NULL, NULL); - tmp = start->next; + tmp = start; + if (skip_first) + tmp = tmp->next; + while (tmp != NULL) { MetaWindow *window = tmp->data; @@ -3965,16 +3969,19 @@ find_tab_forward (MetaDisplay *display, static MetaWindow* find_tab_backward (MetaDisplay *display, MetaTabList type, - MetaScreen *screen, + MetaScreen *screen, MetaWorkspace *workspace, - GList *start) + GList *start, + gboolean skip_last) { GList *tmp; g_return_val_if_fail (start != NULL, NULL); g_return_val_if_fail (workspace != NULL, NULL); - - tmp = start->prev; + + tmp = start; + if (skip_last) + tmp = tmp->prev; while (tmp != NULL) { MetaWindow *window = tmp->data; @@ -4061,6 +4068,7 @@ meta_display_get_tab_next (MetaDisplay *display, MetaWindow *window, gboolean backward) { + gboolean skip; GList *tab_list; tab_list = meta_display_get_tab_list(display, type, @@ -4077,19 +4085,23 @@ meta_display_get_tab_next (MetaDisplay *display, if (backward) return find_tab_backward (display, type, screen, workspace, g_list_find (tab_list, - window)); + window), + TRUE); else return find_tab_forward (display, type, screen, workspace, g_list_find (tab_list, - window)); + window), + TRUE); } - + + skip = display->focus_window != NULL && + IN_TAB_CHAIN (display->focus_window, type); if (backward) return find_tab_backward (display, type, screen, workspace, - tab_list); + tab_list, skip); else return find_tab_forward (display, type, screen, workspace, - tab_list); + tab_list, skip); g_list_free (tab_list); } -- cgit v1.2.1