From 920a847508dcd1490e9e03d3d4a67ef06defc3f4 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Mon, 2 Feb 2009 14:09:04 +0000 Subject: [PATCH] --no-tab-popup && no-tab-popup gconf key Disables the use of popup (and highlight frame) for window cycling. --- src/core/keybindings.c | 23 ++++++++++++++------- src/core/main.c | 12 +++++++++++ src/core/prefs.c | 45 ++++++++++++++++++++++++++++++++++++++++++ src/core/screen.c | 2 +- src/include/prefs.h | 4 ++++ src/ui/tabpopup.c | 23 ++++++++++++++++----- 6 files changed, 96 insertions(+), 13 deletions(-) diff --git a/src/core/keybindings.c b/src/core/keybindings.c index fb77031f3..ce884847d 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2918,16 +2918,25 @@ do_choose_window (MetaDisplay *display, } else { - meta_ui_tab_popup_select (screen->tab_popup, - (MetaTabEntryKey) initial_selection->xwindow); - - if (show_popup) - meta_ui_tab_popup_set_showing (screen->tab_popup, - TRUE); + if (!meta_prefs_get_no_tab_popup ()) + { + meta_ui_tab_popup_select (screen->tab_popup, + (MetaTabEntryKey) initial_selection->xwindow); + + 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); - initial_selection->tab_unminimized = + initial_selection->tab_unminimized = initial_selection->minimized; meta_window_unminimize (initial_selection); } diff --git a/src/core/main.c b/src/core/main.c index 26ab7d459..63bb52e70 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -227,6 +227,7 @@ typedef struct gboolean sync; gboolean composite; gboolean no_composite; + gboolean no_tab_popup; } MetaArguments; #ifdef HAVE_COMPOSITE_EXTENSIONS @@ -316,6 +317,12 @@ meta_parse_options (int *argc, char ***argv, "PLUGINS" }, #endif + { + "no-tab-popup", 0, 0, G_OPTION_ARG_NONE, + &my_args.no_tab_popup, + N_("Whether window popup/frame should be shown when cycling windows."), + NULL + }, {NULL} }; GOptionContext *ctx; @@ -649,6 +656,11 @@ main (int argc, char **argv) } #endif + if (meta_args.no_tab_popup) + { + meta_prefs_override_no_tab_popup (TRUE); + } + if (!meta_display_open ()) meta_exit (META_EXIT_ERROR); diff --git a/src/core/prefs.c b/src/core/prefs.c index f62665389..555483f09 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -70,6 +70,8 @@ #define KEY_LIVE_HIDDEN_WINDOWS "/apps/metacity/general/live_hidden_windows" +#define KEY_NO_TAB_POPUP "/apps/metacity/general/no_tab_popup" + #ifdef HAVE_GCONF static GConfClient *default_client = NULL; static GList *changes = NULL; @@ -119,6 +121,8 @@ static GSList *clutter_plugins = NULL; static gboolean live_hidden_windows = FALSE; +static gboolean no_tab_popup = FALSE; + #ifdef HAVE_GCONF static gboolean handle_preference_update_enum (const gchar *key, GConfValue *value); @@ -429,6 +433,11 @@ static MetaBoolPreference preferences_bool[] = &live_hidden_windows, FALSE, }, + { "/apps/metacity/general/no_tab_popup", + META_PREF_NO_TAB_POPUP, + &no_tab_popup, + FALSE, + }, { NULL, 0, NULL, FALSE }, }; @@ -1801,6 +1810,8 @@ meta_preference_to_string (MetaPreference pref) #endif case META_PREF_LIVE_HIDDEN_WINDOWS: return "LIVE_HIDDEN_WINDOWS"; + case META_PREF_NO_TAB_POPUP: + return "NO_TAB_POPUP"; } return "(unknown)"; @@ -2898,6 +2909,40 @@ meta_prefs_set_live_hidden_windows (gboolean whether) #endif } +gboolean +meta_prefs_get_no_tab_popup (void) +{ + return no_tab_popup; +} + +void +meta_prefs_set_no_tab_popup (gboolean whether) +{ +#ifdef HAVE_GCONF + GError *err = NULL; + + gconf_client_set_bool (default_client, + KEY_NO_TAB_POPUP, + whether, + &err); + + if (err) + { + meta_warning (_("Error setting no tab popup status: %s\n"), + err->message); + g_error_free (err); + } +#else + no_tab_popup = whether; +#endif +} + +void +meta_prefs_override_no_tab_popup (gboolean whether) +{ + no_tab_popup = whether; +} + #ifndef HAVE_GCONF static void init_button_layout(void) diff --git a/src/core/screen.c b/src/core/screen.c index cb3aede82..603c1ef74 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1525,7 +1525,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, screen->number, len, 5, /* FIXME */ - TRUE); + !meta_prefs_get_no_tab_popup ()); for (i = 0; i < len; i++) g_object_unref (entries[i].icon); diff --git a/src/include/prefs.h b/src/include/prefs.h index a30cd8c49..fbeb77000 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -64,6 +64,7 @@ typedef enum META_PREF_CLUTTER_PLUGINS, #endif META_PREF_LIVE_HIDDEN_WINDOWS, + META_PREF_NO_TAB_POPUP, } MetaPreference; typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, @@ -151,6 +152,9 @@ void meta_prefs_override_clutter_plugins (GSList *list); gboolean meta_prefs_get_live_hidden_windows (void); void meta_prefs_set_live_hidden_windows (gboolean whether); +gboolean meta_prefs_get_no_tab_popup (void); +void meta_prefs_set_no_tab_popup (gboolean whether); +void meta_prefs_override_no_tab_popup (gboolean whether); /* XXX FIXME This should be x-macroed, but isn't yet because it would be * difficult (or perhaps impossible) to add the suffixes using the current diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index e8251552d..a006d9272 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -228,8 +228,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, GdkScreen *screen; int screen_width; - popup = g_new (MetaTabPopup, 1); + popup = g_new0 (MetaTabPopup, 1); + popup->outline = outline; + + if (outline) + { popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP); screen = gdk_display_get_screen (gdk_display_get_default (), @@ -253,10 +257,6 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, /* enable resizing, to get never-shrink behavior */ gtk_window_set_resizable (GTK_WINDOW (popup->window), TRUE); - popup->current = NULL; - popup->entries = NULL; - popup->current_selected_entry = NULL; - popup->outline = outline; screen_width = gdk_screen_get_width (screen); for (i = 0; i < entry_count; ++i) @@ -388,6 +388,16 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, gtk_window_set_default_size (GTK_WINDOW (popup->window), max_label_width, -1); + } + else + { + for (i = 0; i < entry_count; ++i) + { + TabEntry* new_entry = + tab_entry_new (&entries[i], 0, outline); + popup->entries = g_list_prepend (popup->entries, new_entry); + } + } return popup; } @@ -413,12 +423,15 @@ meta_ui_tab_popup_free (MetaTabPopup *popup) { meta_verbose ("Destroying tab popup window\n"); + if (popup->outline) + { gtk_widget_destroy (popup->outline_window); gtk_widget_destroy (popup->window); g_list_foreach (popup->entries, free_tab_entry, NULL); g_list_free (popup->entries); + } g_free (popup); }