[mutter] window: Disallow maximization for windows that can't be maximized



commit 7f64d6b92e86e86dcb9bcb0d64d8756d13127a69
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 12 23:18:03 2012 -0400

    window: Disallow maximization for windows that can't be maximized
    
    Windows that have minimum widths larger than the screen can't be maximized,
    even though we put them in a maximized state and allow users to do so:
    the window just won't change size and position. Fix this by simply not giving
    the option to maximize, like what happens for non-resizable windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643606

 src/core/window.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index e37c0fe..89b0390 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4550,6 +4550,10 @@ meta_window_update_monitor (MetaWindow *window)
       if (old)
         g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window);
       g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
+
+      /* If we're changing monitors, we need to update the has_maximize_func flag,
+       * as the working area has changed. */
+      recalc_window_features (window);
     }
 }
 
@@ -8006,6 +8010,23 @@ recalc_window_features (MetaWindow *window)
       window->has_maximize_func = FALSE;
     }
 
+  if (window->has_maximize_func)
+    {
+      MetaRectangle work_area;
+      MetaFrameBorders borders;
+      int min_frame_width, min_frame_height;
+
+      meta_window_get_work_area_current_monitor (window, &work_area);
+      meta_frame_calc_borders (window->frame, &borders);
+
+      min_frame_width = window->size_hints.min_width + borders.visible.left + borders.visible.right;
+      min_frame_height = window->size_hints.min_height + borders.visible.top + borders.visible.bottom;
+
+      if (min_frame_width >= work_area.width ||
+          min_frame_height >= work_area.height)
+        window->has_maximize_func = FALSE;
+    }
+
   meta_topic (META_DEBUG_WINDOW_OPS,
               "Window %s fullscreen = %d not resizable, maximizable = %d fullscreenable = %d min size %dx%d max size %dx%d\n",
               window->desc,



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