From f2f500836ef217bfbd7bbf5ad54c9248cbdb7925 Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Thu, 15 Mar 2012 20:42:11 +0100 Subject: [PATCH] Automaximize large windows on map Windows that start up in a size that is almost as big as the workarea create extra work for the user (resizing or maximizing) so save the user's time by detecting such windows and automaximize them. https://bugzilla.gnome.org/show_bug.cgi?id=671677 --- src/core/window.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index c1cd528af..8c5483954 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -57,7 +57,9 @@ #include /* Windows that unmaximize to a size bigger than that fraction of the workarea - * will be scaled down to that size (while maintaining aspect ratio) */ + * will be scaled down to that size (while maintaining aspect ratio). + * Windows that cover an area greater then this size are automaximized on map. + */ #define MAX_UNMAXIMIZED_WINDOW_AREA .8 static int destroying_windows_disallowed = 0; @@ -3013,7 +3015,20 @@ meta_window_show (MetaWindow *window) } if (!window->placed) - meta_window_force_placement (window); + { + if (window->showing_for_first_time) + { + MetaRectangle work_area; + meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area); + /* Automaximize windows that map with a size > MAX_UNMAXIMIZED_WINDOW_AREA of the work area */ + if (window->rect.width * window->rect.height > work_area.width * work_area.height * MAX_UNMAXIMIZED_WINDOW_AREA) + { + window->maximize_horizontally_after_placement = TRUE; + window->maximize_vertically_after_placement = TRUE; + } + } + meta_window_force_placement (window); + } if (needs_stacking_adjustment) {