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; Window prev_xwindow;
MetaWindow *prev_window; MetaWindow *prev_window;
if (screen != display->grab_screen) if (screen != display->grab_screen || !screen->tab_popup)
return FALSE; return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
if (event->type == KeyRelease && if (event->type == KeyRelease &&
end_keyboard_grab (display, event->xkey.keycode)) end_keyboard_grab (display, event->xkey.keycode))
{ {
@ -2592,11 +2590,9 @@ process_workspace_switch_grab (MetaDisplay *display,
{ {
MetaWorkspace *workspace; MetaWorkspace *workspace;
if (screen != display->grab_screen) if (screen != display->grab_screen || !screen->tab_popup)
return FALSE; return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
if (event->type == KeyRelease && if (event->type == KeyRelease &&
end_keyboard_grab (display, event->xkey.keycode)) end_keyboard_grab (display, event->xkey.keycode))
{ {
@ -2887,7 +2883,9 @@ do_choose_window (MetaDisplay *display,
display->mouse_mode = FALSE; display->mouse_mode = FALSE;
meta_window_activate (initial_selection, event->xkey.time); 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, screen,
NULL, NULL,
show_popup ? show_popup ?
@ -2917,8 +2915,6 @@ do_choose_window (MetaDisplay *display,
meta_window_activate (initial_selection, event->xkey.time); meta_window_activate (initial_selection, event->xkey.time);
} }
else else
{
if (!meta_prefs_get_no_tab_popup ())
{ {
meta_ui_tab_popup_select (screen->tab_popup, meta_ui_tab_popup_select (screen->tab_popup,
(MetaTabEntryKey) initial_selection->xwindow); (MetaTabEntryKey) initial_selection->xwindow);
@ -2933,13 +2929,6 @@ do_choose_window (MetaDisplay *display,
meta_window_unminimize (initial_selection); meta_window_unminimize (initial_selection);
} }
} }
else
{
meta_window_raise (initial_selection);
initial_selection->tab_unminimized =
initial_selection->minimized;
meta_window_unminimize (initial_selection);
}
} }
} }
} }
@ -3311,7 +3300,7 @@ handle_workspace_switch (MetaDisplay *display,
meta_workspace_activate (next, event->xkey.time); 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); 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; tmp = tmp->next;
} }
if (!meta_prefs_get_no_tab_popup ())
screen->tab_popup = meta_ui_tab_popup_new (entries, screen->tab_popup = meta_ui_tab_popup_new (entries,
screen->number, screen->number,
len, len,
5, /* FIXME */ 5, /* FIXME */
!meta_prefs_get_no_tab_popup ()); TRUE);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
g_object_unref (entries[i].icon); g_object_unref (entries[i].icon);
@ -1547,7 +1548,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
int n_workspaces; int n_workspaces;
int current_workspace; int current_workspace;
if (screen->tab_popup) if (screen->tab_popup || meta_prefs_get_no_tab_popup ())
return; return;
current_workspace = meta_workspace_index (screen->active_workspace); current_workspace = meta_workspace_index (screen->active_workspace);