1 === modified file 'src/core/display.c'
2 Index: metacity-2.34.1/src/core/display.c
3 ===================================================================
4 --- metacity-2.34.1.orig/src/core/display.c 2011-08-18 00:09:44.199438223 -0400
5 +++ metacity-2.34.1/src/core/display.c 2011-08-18 00:10:26.650462017 -0400
10 + if (window && meta_prefs_get_auto_maximize_windows())
11 + meta_window_auto_maximize (window);
15 Index: metacity-2.34.1/src/core/prefs.c
16 ===================================================================
17 --- metacity-2.34.1.orig/src/core/prefs.c 2011-08-18 00:10:19.830297517 -0400
18 +++ metacity-2.34.1/src/core/prefs.c 2011-08-18 00:10:26.650462017 -0400
20 static gboolean hide_decorator_tooltip = FALSE;
21 static gboolean show_maximized_titlebars = TRUE;
22 static gboolean workspace_switcher_keyboard_cycle = FALSE;
23 +static gboolean auto_maximize_windows = FALSE;
25 static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
26 static MetaButtonLayout button_layout;
28 &workspace_switcher_keyboard_cycle,
31 + { "/apps/metacity/general/auto_maximize_windows",
32 + META_PREF_AUTO_MAXIMIZE_WINDOWS,
33 + &auto_maximize_windows,
36 { NULL, 0, NULL, FALSE },
41 case META_PREF_WORKSPACE_SWITCHER_KEYBOARD_CYCLE:
42 return "WORKSPACE_SWITCHER_KEYBOARD_CYCLE";
44 + case META_PREF_AUTO_MAXIMIZE_WINDOWS:
45 + return "META_PREF_AUTO_MAXIMIZE_WINDOWS";
49 @@ -2773,6 +2782,12 @@
50 return workspace_switcher_keyboard_cycle;
54 +meta_prefs_get_auto_maximize_windows (void)
56 + return auto_maximize_windows;
60 meta_prefs_get_mouse_button_resize (void)
62 Index: metacity-2.34.1/src/core/window-private.h
63 ===================================================================
64 --- metacity-2.34.1.orig/src/core/window-private.h 2011-03-08 04:31:53.000000000 -0500
65 +++ metacity-2.34.1/src/core/window-private.h 2011-08-18 00:10:26.650462017 -0400
67 void meta_window_maximize_internal (MetaWindow *window,
68 MetaMaximizeFlags directions,
69 MetaRectangle *saved_rect);
70 +void meta_window_auto_maximize (MetaWindow *window);
71 void meta_window_unmaximize (MetaWindow *window,
72 MetaMaximizeFlags directions);
73 void meta_window_make_above (MetaWindow *window);
74 Index: metacity-2.34.1/src/core/window.c
75 ===================================================================
76 --- metacity-2.34.1.orig/src/core/window.c 2011-08-18 00:10:11.330092500 -0400
77 +++ metacity-2.34.1/src/core/window.c 2011-08-18 00:10:26.660462267 -0400
79 #include <X11/extensions/shape.h>
82 -static int destroying_windows_disallowed = 0;
83 +#define AUTO_MAXIMIZE_MINIMUM_COVERAGE 0.75
85 +static int destroying_windows_disallowed = 0;
87 static void update_sm_hints (MetaWindow *window);
88 static void update_net_frame_extents (MetaWindow *window);
89 @@ -2696,6 +2697,30 @@
94 +meta_window_auto_maximize (MetaWindow *window)
96 + const MetaXineramaScreenInfo* info;
97 + int screen_surface, window_surface;
100 + if (window->type != META_WINDOW_NORMAL || !window->has_maximize_func)
103 + if (window->maximized_horizontally || window->maximized_vertically)
106 + info = meta_screen_get_xinerama_for_window (window->display->active_screen, window);
107 + g_return_if_fail (info);
108 + screen_surface = info->rect.width * info->rect.height;
109 + g_return_if_fail (screen_surface != 0);
110 + window_surface = window->rect.width * window->rect.height;
111 + coverage = (double)(window_surface) / screen_surface;
113 + if (coverage > AUTO_MAXIMIZE_MINIMUM_COVERAGE && coverage <= 1.0)
114 + meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
118 unmaximize_window_before_freeing (MetaWindow *window)
120 Index: metacity-2.34.1/src/include/prefs.h
121 ===================================================================
122 --- metacity-2.34.1.orig/src/include/prefs.h 2011-08-18 00:10:19.830297517 -0400
123 +++ metacity-2.34.1/src/include/prefs.h 2011-08-18 00:10:26.660462267 -0400
125 META_PREF_FORCE_FULLSCREEN,
126 META_PREF_HIDE_DECORATOR_TOOLTIP,
127 META_PREF_SHOW_MAXIMIZED_TITLEBARS,
128 - META_PREF_WORKSPACE_SWITCHER_KEYBOARD_CYCLE
129 + META_PREF_AUTO_MAXIMIZE_WINDOWS,
130 + META_PREF_WORKSPACE_SWITCHER_KEYBOARD_CYCLE,
133 typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
135 gboolean meta_prefs_get_capture_before_unmap (void);
136 gboolean meta_prefs_get_workspace_switcher_keyboard_cycle (void);
138 +gboolean meta_prefs_get_auto_maximize_windows (void);
141 * Sets whether the compositor is turned on.
142 Index: metacity-2.34.1/src/metacity.schemas.in.in
143 ===================================================================
144 --- metacity-2.34.1.orig/src/metacity.schemas.in.in 2011-08-18 00:10:19.830297517 -0400
145 +++ metacity-2.34.1/src/metacity.schemas.in.in 2011-08-18 00:10:26.660462267 -0400
150 + <key>/schemas/apps/metacity/general/auto_maximize_windows</key>
151 + <applyto>/apps/metacity/general/auto_maximize_windows</applyto>
152 + <owner>metacity</owner>
154 + <default>false</default>
156 + <short>Automatically Maximize Windows</short>
158 + Determines if windows should be automatically maximized when shown
159 + if they already cover most of the screen.
165 <key>/schemas/apps/metacity/general/audible_bell</key>
166 <applyto>/apps/metacity/general/audible_bell</applyto>
167 <owner>metacity</owner>