From e2d0da87ec3f7add9643c7f7f424df080d95d8dc Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 9 Jan 2012 17:55:18 +0100 Subject: Introduce key combination to switch between windows on all workspaces taken from https://bugzilla.gnome.org/show_bug.cgi?id=577699 --- src/core/display-private.h | 3 +- src/core/display.c | 121 +++++++++++++++++++++++++++--------------- src/core/keybindings.c | 11 ++++ src/include/all-keybindings.h | 6 +++ src/include/common.h | 2 + 5 files changed, 100 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/core/display-private.h b/src/core/display-private.h index 692e25f2..c59c5e19 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -445,7 +445,8 @@ typedef enum { META_TAB_LIST_NORMAL, META_TAB_LIST_DOCKS, - META_TAB_LIST_GROUP + META_TAB_LIST_GROUP, + META_TAB_LIST_NORMAL_ALL_WORKSPACES } MetaTabList; typedef enum diff --git a/src/core/display.c b/src/core/display.c index 59ec9021..647581f5 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -90,7 +90,9 @@ (g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || \ g == META_GRAB_OP_KEYBOARD_TABBING_DOCK || \ g == META_GRAB_OP_KEYBOARD_TABBING_GROUP || \ + g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL || \ + g == META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_DOCK || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_GROUP) @@ -1141,9 +1143,11 @@ grab_op_is_keyboard (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_GROUP: case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP: case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: @@ -3625,12 +3629,23 @@ meta_display_begin_grab_op (MetaDisplay *display, META_TAB_LIST_NORMAL, META_TAB_SHOW_ICON); break; + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: + meta_screen_ensure_tab_popup (screen, + META_TAB_LIST_NORMAL_ALL_WORKSPACES, + META_TAB_SHOW_ICON); + break; case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: meta_screen_ensure_tab_popup (screen, META_TAB_LIST_NORMAL, META_TAB_SHOW_INSTANTLY); break; + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: + meta_screen_ensure_tab_popup (screen, + META_TAB_LIST_NORMAL_ALL_WORKSPACES, + META_TAB_SHOW_INSTANTLY); + break; + case META_GRAB_OP_KEYBOARD_TABBING_DOCK: meta_screen_ensure_tab_popup (screen, META_TAB_LIST_DOCKS, @@ -4441,7 +4456,9 @@ get_focussed_group (MetaDisplay *display) return NULL; } -#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ +#define IN_TAB_CHAIN(w,t) \ + (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ + || ((t) == META_TAB_LIST_NORMAL_ALL_WORKSPACES && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \ || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focussed_group(w->display)))) @@ -4532,56 +4549,76 @@ GList* meta_display_get_tab_list (MetaDisplay *display, MetaTabList type, MetaScreen *screen, - MetaWorkspace *workspace) + MetaWorkspace *active_workspace) { - GList *tab_list; + GList *tab_list, *workspace_list, *l, link; + MetaWorkspace *workspace; - g_return_val_if_fail (workspace != NULL, NULL); + g_return_val_if_fail (active_workspace != NULL, NULL); + + if (type == META_TAB_LIST_NORMAL_ALL_WORKSPACES) + { + workspace_list = screen->workspaces; + type = META_TAB_LIST_NORMAL; + } + else + { + link.next = NULL; + link.prev = NULL; + link.data = active_workspace; + workspace_list = &link; + } + tab_list = NULL; /* Windows sellout mode - MRU order. Collect unminimized windows * then minimized so minimized windows aren't in the way so much. */ - { - GList *tmp; - - tab_list = NULL; - tmp = workspace->mru_list; - while (tmp != NULL) - { - MetaWindow *window = tmp->data; - - if (!window->minimized && - window->screen == screen && - IN_TAB_CHAIN (window, type)) - tab_list = g_list_prepend (tab_list, window); - - tmp = tmp->next; - } - } - - { - GList *tmp; - - tmp = workspace->mru_list; - while (tmp != NULL) - { - MetaWindow *window = tmp->data; - - if (window->minimized && - window->screen == screen && - IN_TAB_CHAIN (window, type)) - tab_list = g_list_prepend (tab_list, window); - - tmp = tmp->next; - } - } - + for (l = workspace_list; l != NULL; l = l->next) + { + GList *tmp; + + workspace = l->data; + + tmp = workspace->mru_list; + while (tmp != NULL) + { + MetaWindow *window = tmp->data; + + if (!window->minimized && + window->screen == screen && + IN_TAB_CHAIN (window, type)) + tab_list = g_list_prepend (tab_list, window); + + tmp = tmp->next; + } + } + + for (l = workspace_list; l != NULL; l = l->next) + { + GList *tmp; + + workspace = l->data; + + tmp = workspace->mru_list; + while (tmp != NULL) + { + MetaWindow *window = tmp->data; + + if (window->minimized && + window->screen == screen && + IN_TAB_CHAIN (window, type)) + tab_list = g_list_prepend (tab_list, window); + + tmp = tmp->next; + } + } + tab_list = g_list_reverse (tab_list); - + { GSList *tmp; MetaWindow *l_window; - + tmp = meta_display_list_windows (display); /* Go through all windows */ @@ -4591,7 +4628,7 @@ meta_display_get_tab_list (MetaDisplay *display, /* Check to see if it demands attention */ if (l_window->wm_state_demands_attention && - l_window->workspace!=workspace && + l_window->workspace!=active_workspace && IN_TAB_CHAIN (l_window, type)) { /* if it does, add it to the popup */ diff --git a/src/core/keybindings.c b/src/core/keybindings.c index b9371c85..e1d87920 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1340,9 +1340,11 @@ meta_display_process_key_event (MetaDisplay *display, break; case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_GROUP: case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP: meta_topic (META_DEBUG_KEYBINDINGS, @@ -2029,6 +2031,7 @@ process_tab_grab (MetaDisplay *display, target_window->desc); display->mouse_mode = FALSE; meta_window_activate (target_window, event->xkey.time); + meta_workspace_activate (target_window->workspace, event->xkey.time); meta_topic (META_DEBUG_KEYBINDINGS, "Ending grab early so we can focus the target window\n"); @@ -2070,6 +2073,7 @@ process_tab_grab (MetaDisplay *display, switch (display->grab_op) { case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: /* carry on */ break; @@ -2087,6 +2091,7 @@ process_tab_grab (MetaDisplay *display, switch (display->grab_op) { case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: /* carry on */ break; @@ -2810,6 +2815,8 @@ tab_op_from_tab_type (MetaTabList type) { case META_TAB_LIST_NORMAL: return META_GRAB_OP_KEYBOARD_TABBING_NORMAL; + case META_TAB_LIST_NORMAL_ALL_WORKSPACES: + return META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES; case META_TAB_LIST_DOCKS: return META_GRAB_OP_KEYBOARD_TABBING_DOCK; case META_TAB_LIST_GROUP: @@ -2828,6 +2835,8 @@ cycle_op_from_tab_type (MetaTabList type) { case META_TAB_LIST_NORMAL: return META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL; + case META_TAB_LIST_NORMAL_ALL_WORKSPACES: + return META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES; case META_TAB_LIST_DOCKS: return META_GRAB_OP_KEYBOARD_ESCAPING_DOCK; case META_TAB_LIST_GROUP: @@ -2888,6 +2897,7 @@ do_choose_window (MetaDisplay *display, initial_selection->desc); display->mouse_mode = FALSE; meta_window_activate (initial_selection, event->xkey.time); + meta_workspace_activate (initial_selection->workspace, event->xkey.time); } else if (meta_display_begin_grab_op (display, screen, @@ -2917,6 +2927,7 @@ do_choose_window (MetaDisplay *display, meta_display_end_grab_op (display, event->xkey.time); display->mouse_mode = FALSE; meta_window_activate (initial_selection, event->xkey.time); + meta_workspace_activate (initial_selection->workspace, event->xkey.time); } else { diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index ee9b5d37..26834454 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -158,6 +158,12 @@ keybind (switch_windows, handle_switch, META_TAB_LIST_NORMAL, keybind (switch_windows_backward, handle_switch, META_TAB_LIST_NORMAL, REVERSES_AND_REVERSED, NULL, _("Move backward between windows, using a popup window")) +keybind (switch_windows_all, handle_switch, META_TAB_LIST_NORMAL_ALL_WORKSPACES, + BINDING_REVERSES, NULL, + _("Move between windows on all workspaces, using a popup window")) +keybind (switch_windows_all_backward,handle_switch, META_TAB_LIST_NORMAL_ALL_WORKSPACES, + REVERSES_AND_REVERSED, NULL, + _("Move backward between windows on all workspaces, using a popup window")) keybind (switch_panels, handle_switch, META_TAB_LIST_DOCKS, BINDING_REVERSES, "Tab", _("Move between panels and the desktop, using a popup window")) diff --git a/src/include/common.h b/src/include/common.h index 73611e36..a7eb89b1 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -116,9 +116,11 @@ typedef enum /* Alt+Tab */ META_GRAB_OP_KEYBOARD_TABBING_NORMAL, META_GRAB_OP_KEYBOARD_TABBING_DOCK, + META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES, /* Alt+Esc */ META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL, + META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES, META_GRAB_OP_KEYBOARD_ESCAPING_DOCK, META_GRAB_OP_KEYBOARD_ESCAPING_GROUP, -- cgit v1.2.1