Do not allocate the tab_pop up object at all when the --no-tab-popup option is set

This option is intended primarily so that and Alt+Tab implementation can be
  provided in a plugin, so having the object around makes no sense.
This commit is contained in:
Tomas Frydrych 2009-02-02 15:28:26 +00:00
parent 920a847508
commit 5f9a4ab8cc
2 changed files with 17 additions and 27 deletions

View File

@ -1979,11 +1979,9 @@ process_tab_grab (MetaDisplay *display,
Window prev_xwindow;
MetaWindow *prev_window;
if (screen != display->grab_screen)
if (screen != display->grab_screen || !screen->tab_popup)
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
if (event->type == KeyRelease &&
end_keyboard_grab (display, event->xkey.keycode))
{
@ -2592,11 +2590,9 @@ process_workspace_switch_grab (MetaDisplay *display,
{
MetaWorkspace *workspace;
if (screen != display->grab_screen)
if (screen != display->grab_screen || !screen->tab_popup)
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
if (event->type == KeyRelease &&
end_keyboard_grab (display, event->xkey.keycode))
{
@ -2887,7 +2883,9 @@ do_choose_window (MetaDisplay *display,
display->mouse_mode = FALSE;
meta_window_activate (initial_selection, event->xkey.time);
}
else if (meta_display_begin_grab_op (display,
else if (!meta_prefs_get_no_tab_popup ())
{
if (meta_display_begin_grab_op (display,
screen,
NULL,
show_popup ?
@ -2918,21 +2916,11 @@ do_choose_window (MetaDisplay *display,
}
else
{
if (!meta_prefs_get_no_tab_popup ())
{
meta_ui_tab_popup_select (screen->tab_popup,
(MetaTabEntryKey) initial_selection->xwindow);
meta_ui_tab_popup_select (screen->tab_popup,
(MetaTabEntryKey) initial_selection->xwindow);
if (show_popup)
if (show_popup)
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
else
{
meta_window_raise (initial_selection);
initial_selection->tab_unminimized =
initial_selection->minimized;
meta_window_unminimize (initial_selection);
}
}
else
{
meta_window_raise (initial_selection);
@ -2943,6 +2931,7 @@ do_choose_window (MetaDisplay *display,
}
}
}
}
}
static void
@ -3311,7 +3300,7 @@ handle_workspace_switch (MetaDisplay *display,
meta_workspace_activate (next, event->xkey.time);
if (grabbed_before_release)
if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
{
meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next);

View File

@ -1521,11 +1521,12 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
tmp = tmp->next;
}
screen->tab_popup = meta_ui_tab_popup_new (entries,
screen->number,
len,
5, /* FIXME */
!meta_prefs_get_no_tab_popup ());
if (!meta_prefs_get_no_tab_popup ())
screen->tab_popup = meta_ui_tab_popup_new (entries,
screen->number,
len,
5, /* FIXME */
TRUE);
for (i = 0; i < len; i++)
g_object_unref (entries[i].icon);
@ -1547,7 +1548,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
int n_workspaces;
int current_workspace;
if (screen->tab_popup)
if (screen->tab_popup || meta_prefs_get_no_tab_popup ())
return;
current_workspace = meta_workspace_index (screen->active_workspace);