summaryrefslogtreecommitdiff
path: root/src/keybindings.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-09-04 04:15:46 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-09-04 04:15:46 +0000
commitcbb0b8e66cd094b19f005d3559679f5dbfcaafd9 (patch)
tree85fc4715645d276cccf8c3056278f69ffec33bb9 /src/keybindings.c
parenta6a7407faa0fa30cb62cfc0494c2d905d975412b (diff)
downloadmetacity-cbb0b8e66cd094b19f005d3559679f5dbfcaafd9.tar.gz
new function
2002-09-03 Havoc Pennington <hp@pobox.com> * src/display.c (meta_display_get_tab_current): new function * src/keybindings.c (do_choose_window): apply modified patch from JeyaSudha to still display tab popup if only one window is on the desktop.
Diffstat (limited to 'src/keybindings.c')
-rw-r--r--src/keybindings.c105
1 files changed, 48 insertions, 57 deletions
diff --git a/src/keybindings.c b/src/keybindings.c
index f46ec266..5bb26762 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -2333,77 +2333,68 @@ do_choose_window (MetaDisplay *display,
MetaKeyBinding *binding,
gboolean show_popup)
{
- MetaWindow *window;
+ MetaScreen *screen;
MetaTabList type;
gboolean backward;
+ MetaWindow *initial_selection;
type = GPOINTER_TO_INT (binding->handler->data);
meta_topic (META_DEBUG_KEYBINDINGS,
"Tab list = %d show_popup = %d\n", type, show_popup);
+
+ screen = meta_display_screen_for_root (display,
+ event->xkey.root);
- /* backward if shift is down, this isn't configurable */
- backward = (event->xkey.state & ShiftMask) != 0;
-
- window = NULL;
-
- if (display->focus_window != NULL)
+ if (screen == NULL)
{
- window = meta_display_get_tab_next (display,
- type,
- display->focus_window->screen,
- display->focus_window->screen->active_workspace,
- display->focus_window,
- backward);
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "No screen for root 0x%lx, not doing choose_window\n",
+ event->xkey.root);
+ return;
}
- if (window == NULL)
- {
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xkey.root);
+ /* backward if shift is down, this isn't configurable */
+ backward = (event->xkey.state & ShiftMask) != 0;
- /* We get the screen because event_window may be NULL,
- * in which case we can't use event_window->screen
- */
- if (screen)
- {
- window = meta_display_get_tab_next (screen->display,
- type,
- screen,
- screen->active_workspace,
- NULL,
- backward);
- }
- }
+ initial_selection = meta_display_get_tab_next (display,
+ type,
+ screen,
+ screen->active_workspace,
+ NULL,
+ backward);
- if (window)
- {
- meta_topic (META_DEBUG_KEYBINDINGS,
- "Starting tab/cycle between windows\n");
-
- if (meta_display_begin_grab_op (window->display,
- window->screen,
- NULL,
- show_popup ?
- tab_op_from_tab_type (type) :
- cycle_op_from_tab_type (type),
- FALSE,
- 0,
- event->xkey.state & ~(display->ignored_modifier_mask),
- event->xkey.time,
- 0, 0))
- {
- meta_ui_tab_popup_select (window->screen->tab_popup,
- (MetaTabEntryKey) window->xwindow);
+ /* Note that focus_window may not be in the tab chain, but it's OK */
+ if (initial_selection == NULL)
+ initial_selection = meta_display_get_tab_current (display,
+ type, screen,
+ screen->active_workspace);
+
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "Initially selecting window %s\n",
+ initial_selection ? initial_selection->desc : "(none)");
+
+ if (initial_selection != NULL &&
+ meta_display_begin_grab_op (display,
+ screen,
+ NULL,
+ show_popup ?
+ tab_op_from_tab_type (type) :
+ cycle_op_from_tab_type (type),
+ FALSE,
+ 0,
+ event->xkey.state & ~(display->ignored_modifier_mask),
+ event->xkey.time,
+ 0, 0))
+ {
+ meta_ui_tab_popup_select (screen->tab_popup,
+ (MetaTabEntryKey) initial_selection->xwindow);
- if (show_popup)
- meta_ui_tab_popup_set_showing (window->screen->tab_popup,
- TRUE);
- else
- meta_window_raise (window);
- }
+ if (show_popup)
+ meta_ui_tab_popup_set_showing (screen->tab_popup,
+ TRUE);
+ else
+ meta_window_raise (initial_selection);
}
}