Reorganize tab popup code a bit more cleanly.

Rather than trying to reverse-engineer what kind of tab/workspace
popup to create from within meta_display_begin_grab_op(), just create
the popup directly from do_choose_window()/handle_workspace_switch()
after completing the grab, since they already know which kind they
want.

Also add meta_screen_destroy_tab_popup()/_destroy_workspace_popup()
rather than having meta_display_end_grab_op() poke into MetaScreen's
internals itself.

http://bugzilla.gnome.org/show_bug.cgi?id=580917
This commit is contained in:
Dan Winship 2009-04-27 10:01:30 -04:00
parent f55509aadd
commit cbf4be04fc
4 changed files with 32 additions and 48 deletions

View File

@ -3512,48 +3512,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
meta_stack_get_positions (screen->stack);
}
/* Do this last, after everything is set up. */
switch (op)
{
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
meta_screen_ensure_tab_popup (screen,
META_TAB_LIST_NORMAL,
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_TABBING_DOCK:
meta_screen_ensure_tab_popup (screen,
META_TAB_LIST_DOCKS,
META_TAB_SHOW_ICON);
break;
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
meta_screen_ensure_tab_popup (screen,
META_TAB_LIST_DOCKS,
META_TAB_SHOW_INSTANTLY);
break;
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
meta_screen_ensure_tab_popup (screen,
META_TAB_LIST_GROUP,
META_TAB_SHOW_ICON);
break;
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
meta_screen_ensure_tab_popup (screen,
META_TAB_LIST_GROUP,
META_TAB_SHOW_INSTANTLY);
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
meta_screen_ensure_workspace_popup (screen);
break;
default:
break;
}
if (display->grab_window)
{
meta_window_refresh_resize_popup (display->grab_window);
@ -3593,11 +3551,10 @@ meta_display_end_grab_op (MetaDisplay *display,
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op) ||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
{
if (display->grab_screen->tab_popup)
{
meta_ui_tab_popup_free (display->grab_screen->tab_popup);
display->grab_screen->tab_popup = NULL;
}
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op))
meta_screen_destroy_tab_popup (display->grab_screen);
else
meta_screen_destroy_workspace_popup (display->grab_screen);
/* If the ungrab here causes an EnterNotify, ignore it for
* sloppy focus

View File

@ -3074,6 +3074,10 @@ do_choose_window (MetaDisplay *display,
return;
}
meta_screen_ensure_tab_popup (screen, type,
show_popup ? META_TAB_SHOW_ICON :
META_TAB_SHOW_INSTANTLY);
meta_ui_tab_popup_select (screen->tab_popup,
(MetaTabEntryKey) initial_selection->xwindow);
@ -3455,6 +3459,7 @@ handle_workspace_switch (MetaDisplay *display,
if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
{
meta_screen_ensure_workspace_popup (screen);
meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next);
/* only after selecting proper space */

View File

@ -167,7 +167,9 @@ void meta_screen_update_cursor (MetaScreen *scree
void meta_screen_ensure_tab_popup (MetaScreen *screen,
MetaTabList list_type,
MetaTabShowType show_type);
void meta_screen_destroy_tab_popup (MetaScreen *screen);
void meta_screen_ensure_workspace_popup (MetaScreen *screen);
void meta_screen_destroy_workspace_popup (MetaScreen *screen);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);

View File

@ -1533,6 +1533,16 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
/* don't show tab popup, since proper window isn't selected yet */
}
void
meta_screen_destroy_tab_popup (MetaScreen *screen)
{
if (screen->tab_popup)
{
meta_ui_tab_popup_free (screen->tab_popup);
screen->tab_popup = NULL;
}
}
void
meta_screen_ensure_workspace_popup (MetaScreen *screen)
{
@ -1601,6 +1611,16 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
/* don't show tab popup, since proper space isn't selected yet */
}
void
meta_screen_destroy_workspace_popup (MetaScreen *screen)
{
if (screen->tab_popup)
{
meta_ui_tab_popup_free (screen->tab_popup);
screen->tab_popup = NULL;
}
}
MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)