From 2a2ac52726bcb801cfa1466cb590ef2067555aff Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Sat, 8 Sep 2012 11:34:27 +0200 Subject: [PATCH] automaximize: Make it optional Make automaximize optional by adding a gsetting "auto-maximize" (defaults to true). https://bugzilla.gnome.org/show_bug.cgi?id=680990 --- src/core/prefs.c | 17 +++++++++++++++++ src/core/window.c | 2 +- src/meta/prefs.h | 4 +++- src/org.gnome.mutter.gschema.xml.in | 9 +++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/core/prefs.c b/src/core/prefs.c index 316d122d0..7e7c250c5 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -99,6 +99,7 @@ static gboolean resize_with_right_button = FALSE; static gboolean edge_tiling = FALSE; static gboolean force_fullscreen = TRUE; static gboolean ignore_request_hide_titlebar = FALSE; +static gboolean auto_maximize = TRUE; static GDesktopVisualBellType visual_bell_type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH; static MetaButtonLayout button_layout; @@ -368,6 +369,13 @@ static MetaBoolPreference preferences_bool[] = }, &no_tab_popup, }, + { + { "auto-maximize", + SCHEMA_MUTTER, + META_PREF_AUTO_MAXIMIZE, + }, + &auto_maximize, + }, { { NULL, 0, 0 }, NULL }, }; @@ -1666,6 +1674,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_DYNAMIC_WORKSPACES: return "DYNAMIC_WORKSPACES"; + + case META_PREF_AUTO_MAXIMIZE: + return "AUTO_MAXIMIZE"; } return "(unknown)"; @@ -2091,6 +2102,12 @@ meta_prefs_get_edge_tiling () return edge_tiling; } +gboolean +meta_prefs_get_auto_maximize (void) +{ + return auto_maximize; +} + MetaKeyBindingAction meta_prefs_get_keybinding_action (const char *name) { diff --git a/src/core/window.c b/src/core/window.c index 059d5b048..e891bd5e1 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3020,7 +3020,7 @@ meta_window_show (MetaWindow *window) if (!window->placed) { - if (window->showing_for_first_time && window->has_maximize_func) + if (meta_prefs_get_auto_maximize() && window->showing_for_first_time && window->has_maximize_func) { MetaRectangle work_area; meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area); diff --git a/src/meta/prefs.h b/src/meta/prefs.h index 6fe31a360..99a9be7ae 100644 --- a/src/meta/prefs.h +++ b/src/meta/prefs.h @@ -67,7 +67,8 @@ typedef enum META_PREF_FORCE_FULLSCREEN, META_PREF_WORKSPACES_ONLY_ON_PRIMARY, META_PREF_NO_TAB_POPUP, - META_PREF_DRAGGABLE_BORDER_WIDTH + META_PREF_DRAGGABLE_BORDER_WIDTH, + META_PREF_AUTO_MAXIMIZE } MetaPreference; typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, @@ -105,6 +106,7 @@ gboolean meta_prefs_get_focus_change_on_pointer_rest (void); gboolean meta_prefs_get_gnome_accessibility (void); gboolean meta_prefs_get_gnome_animations (void); gboolean meta_prefs_get_edge_tiling (void); +gboolean meta_prefs_get_auto_maximize (void); void meta_prefs_get_button_layout (MetaButtonLayout *button_layout); diff --git a/src/org.gnome.mutter.gschema.xml.in b/src/org.gnome.mutter.gschema.xml.in index a2b9eec0b..e921d1e75 100644 --- a/src/org.gnome.mutter.gschema.xml.in +++ b/src/org.gnome.mutter.gschema.xml.in @@ -84,6 +84,15 @@ + + true + <_summary>Auto maximize nearly monitor sized windows + <_description> + If enabled, monitor nearly monitor sized windows automatically get + maximized when mapped. + + +