--no-tab-popup && no-tab-popup gconf key

Disables the use of popup (and highlight frame) for window cycling.
This commit is contained in:
Tomas Frydrych 2009-02-02 14:09:04 +00:00
parent 1e17ba1768
commit 920a847508
6 changed files with 96 additions and 13 deletions

View File

@ -2918,16 +2918,25 @@ do_choose_window (MetaDisplay *display,
} }
else else
{ {
meta_ui_tab_popup_select (screen->tab_popup, if (!meta_prefs_get_no_tab_popup ())
(MetaTabEntryKey) initial_selection->xwindow); {
meta_ui_tab_popup_select (screen->tab_popup,
if (show_popup) (MetaTabEntryKey) initial_selection->xwindow);
meta_ui_tab_popup_set_showing (screen->tab_popup,
TRUE); 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 else
{ {
meta_window_raise (initial_selection); meta_window_raise (initial_selection);
initial_selection->tab_unminimized = initial_selection->tab_unminimized =
initial_selection->minimized; initial_selection->minimized;
meta_window_unminimize (initial_selection); meta_window_unminimize (initial_selection);
} }

View File

@ -227,6 +227,7 @@ typedef struct
gboolean sync; gboolean sync;
gboolean composite; gboolean composite;
gboolean no_composite; gboolean no_composite;
gboolean no_tab_popup;
} MetaArguments; } MetaArguments;
#ifdef HAVE_COMPOSITE_EXTENSIONS #ifdef HAVE_COMPOSITE_EXTENSIONS
@ -316,6 +317,12 @@ meta_parse_options (int *argc, char ***argv,
"PLUGINS" "PLUGINS"
}, },
#endif #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} {NULL}
}; };
GOptionContext *ctx; GOptionContext *ctx;
@ -649,6 +656,11 @@ main (int argc, char **argv)
} }
#endif #endif
if (meta_args.no_tab_popup)
{
meta_prefs_override_no_tab_popup (TRUE);
}
if (!meta_display_open ()) if (!meta_display_open ())
meta_exit (META_EXIT_ERROR); meta_exit (META_EXIT_ERROR);

View File

@ -70,6 +70,8 @@
#define KEY_LIVE_HIDDEN_WINDOWS "/apps/metacity/general/live_hidden_windows" #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 #ifdef HAVE_GCONF
static GConfClient *default_client = NULL; static GConfClient *default_client = NULL;
static GList *changes = NULL; static GList *changes = NULL;
@ -119,6 +121,8 @@ static GSList *clutter_plugins = NULL;
static gboolean live_hidden_windows = FALSE; static gboolean live_hidden_windows = FALSE;
static gboolean no_tab_popup = FALSE;
#ifdef HAVE_GCONF #ifdef HAVE_GCONF
static gboolean handle_preference_update_enum (const gchar *key, GConfValue *value); static gboolean handle_preference_update_enum (const gchar *key, GConfValue *value);
@ -429,6 +433,11 @@ static MetaBoolPreference preferences_bool[] =
&live_hidden_windows, &live_hidden_windows,
FALSE, FALSE,
}, },
{ "/apps/metacity/general/no_tab_popup",
META_PREF_NO_TAB_POPUP,
&no_tab_popup,
FALSE,
},
{ NULL, 0, NULL, FALSE }, { NULL, 0, NULL, FALSE },
}; };
@ -1801,6 +1810,8 @@ meta_preference_to_string (MetaPreference pref)
#endif #endif
case META_PREF_LIVE_HIDDEN_WINDOWS: case META_PREF_LIVE_HIDDEN_WINDOWS:
return "LIVE_HIDDEN_WINDOWS"; return "LIVE_HIDDEN_WINDOWS";
case META_PREF_NO_TAB_POPUP:
return "NO_TAB_POPUP";
} }
return "(unknown)"; return "(unknown)";
@ -2898,6 +2909,40 @@ meta_prefs_set_live_hidden_windows (gboolean whether)
#endif #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 #ifndef HAVE_GCONF
static void static void
init_button_layout(void) init_button_layout(void)

View File

@ -1525,7 +1525,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
screen->number, screen->number,
len, len,
5, /* FIXME */ 5, /* FIXME */
TRUE); !meta_prefs_get_no_tab_popup ());
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
g_object_unref (entries[i].icon); g_object_unref (entries[i].icon);

View File

@ -64,6 +64,7 @@ typedef enum
META_PREF_CLUTTER_PLUGINS, META_PREF_CLUTTER_PLUGINS,
#endif #endif
META_PREF_LIVE_HIDDEN_WINDOWS, META_PREF_LIVE_HIDDEN_WINDOWS,
META_PREF_NO_TAB_POPUP,
} MetaPreference; } MetaPreference;
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, 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); gboolean meta_prefs_get_live_hidden_windows (void);
void meta_prefs_set_live_hidden_windows (gboolean whether); 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 /* 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 * difficult (or perhaps impossible) to add the suffixes using the current

View File

@ -228,8 +228,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
GdkScreen *screen; GdkScreen *screen;
int screen_width; 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); popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP);
screen = gdk_display_get_screen (gdk_display_get_default (), 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 */ /* enable resizing, to get never-shrink behavior */
gtk_window_set_resizable (GTK_WINDOW (popup->window), gtk_window_set_resizable (GTK_WINDOW (popup->window),
TRUE); TRUE);
popup->current = NULL;
popup->entries = NULL;
popup->current_selected_entry = NULL;
popup->outline = outline;
screen_width = gdk_screen_get_width (screen); screen_width = gdk_screen_get_width (screen);
for (i = 0; i < entry_count; ++i) 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), gtk_window_set_default_size (GTK_WINDOW (popup->window),
max_label_width, max_label_width,
-1); -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; return popup;
} }
@ -413,12 +423,15 @@ meta_ui_tab_popup_free (MetaTabPopup *popup)
{ {
meta_verbose ("Destroying tab popup window\n"); meta_verbose ("Destroying tab popup window\n");
if (popup->outline)
{
gtk_widget_destroy (popup->outline_window); gtk_widget_destroy (popup->outline_window);
gtk_widget_destroy (popup->window); gtk_widget_destroy (popup->window);
g_list_foreach (popup->entries, free_tab_entry, NULL); g_list_foreach (popup->entries, free_tab_entry, NULL);
g_list_free (popup->entries); g_list_free (popup->entries);
}
g_free (popup); g_free (popup);
} }