[metacity/wip/muktupavels/issue-33: 5/6] window: avoid incorrect warning about resizability




commit f79c06aef43526d765aff2982053d201d8d929eb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Oct 3 01:41:49 2022 +0300

    window: avoid incorrect warning about resizability
    
    When minimum size is not equal to maximimum size and resize is
    disabled with mwm_has_resize_func we are printing warning:
      Window sets an MWM hint indicating it isn't resizable, but sets
      min size 1 x 1 and max size 2147483647 x 2147483647; this doesn't
      make much sense.
    
    Sometimes windows does not set minimum and/or maximum sizes. Comment
    says that apps that does not set WM_NORMAL_HINTS are basically
    broken and complains that it does not make much sense. At the same
    time it does not make sense to spam user with such warning when
    window did not set min and max size.
    
    That warning was introduced in commit b9002db37faf. Redo code to
    ignore mwm_has_resize_func only if window sets both sizes.

 src/core/window.c | 46 ++++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 194f42b7..8c49770d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6793,28 +6793,34 @@ recalc_window_features (MetaWindow *window)
   window->has_minimize_func = window->mwm_has_minimize_func;
   window->has_maximize_func = window->mwm_has_maximize_func;
   window->has_move_func = window->mwm_has_move_func;
+  window->has_resize_func = window->mwm_has_resize_func;
 
-  window->has_resize_func = TRUE;
-
-  /* If min_size == max_size, then don't allow resize */
-  if (window->size_hints.min_width == window->size_hints.max_width &&
-      window->size_hints.min_height == window->size_hints.max_height)
-    window->has_resize_func = FALSE;
-  else if (!window->mwm_has_resize_func)
-    {
-      /* We ignore mwm_has_resize_func because WM_NORMAL_HINTS is the
-       * authoritative source for that info. Some apps such as mplayer or
-       * xine disable resize via MWM but not WM_NORMAL_HINTS, but that
-       * leads to e.g. us not fullscreening their windows.  Apps that set
-       * MWM but not WM_NORMAL_HINTS are basically broken. We complain
-       * about these apps but make them work.
-       */
+  if ((window->size_hints.flags & PMinSize) == PMinSize &&
+      (window->size_hints.flags & PMaxSize) == PMaxSize)
+    {
+      /* If min_size == max_size, then don't allow resize */
+      if (window->size_hints.min_width == window->size_hints.max_width &&
+          window->size_hints.min_height == window->size_hints.max_height)
+        {
+          window->has_resize_func = FALSE;
+        }
+      else if (!window->mwm_has_resize_func)
+        {
+          /* We ignore mwm_has_resize_func because WM_NORMAL_HINTS is the
+           * authoritative source for that info. Some apps such as mplayer or
+           * xine disable resize via MWM but not WM_NORMAL_HINTS, but that
+           * leads to e.g. us not fullscreening their windows.  Apps that set
+           * MWM but not WM_NORMAL_HINTS are basically broken. We complain
+           * about these apps but make them work.
+           */
+          window->has_resize_func = TRUE;
 
-      g_warning ("Window %s sets an MWM hint indicating it isn't resizable, "
-                 "but sets min size %d x %d and max size %d x %d; this "
-                 "doesn't make much sense.", window->desc,
-                 window->size_hints.min_width, window->size_hints.min_height,
-                 window->size_hints.max_width, window->size_hints.max_height);
+          g_warning ("Window %s sets an MWM hint indicating it isn't resizable, "
+                     "but sets min size %d x %d and max size %d x %d; this "
+                     "doesn't make much sense.", window->desc,
+                     window->size_hints.min_width, window->size_hints.min_height,
+                     window->size_hints.max_width, window->size_hints.max_height);
+        }
     }
 
   window->has_shade_func = TRUE;


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