[mutter] Automaximize large windows on map



commit f2f500836ef217bfbd7bbf5ad54c9248cbdb7925
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Thu Mar 15 20:42:11 2012 +0100

    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 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index c1cd528..8c54839 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -57,7 +57,9 @@
 #include <X11/extensions/Xcomposite.h>
 
 /* 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)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]