[metacity] xprops: simplify size_hints_from_results



commit 3396ec611e48b0a1063ce07cf05247424564693d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Oct 2 22:35:01 2022 +0300

    xprops: simplify size_hints_from_results

 src/core/window-props.c |  9 +--------
 src/core/xprops.c       | 19 ++++++++-----------
 src/include/xprops.h    |  6 +-----
 3 files changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 0b42e569..fcd1e90e 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1163,13 +1163,6 @@ meta_set_normal_hints (MetaWindow *window,
   w = window->size_hints.width;
   h = window->size_hints.height;
 
-  /* as far as I can tell, value->v.size_hints.flags is just to
-   * check whether we had old-style normal hints without gravity,
-   * base size as returned by XGetNormalHints(), so we don't
-   * really use it as we fixup window->size_hints to have those
-   * fields if they're missing.
-   */
-
   /*
    * When the window is first created, NULL hints will
    * be passed in which will initialize all of the fields
@@ -1499,7 +1492,7 @@ reload_normal_hints (MetaWindow    *window,
 
       old_hints = window->size_hints;
 
-      meta_set_normal_hints (window, value->v.size_hints.hints);
+      meta_set_normal_hints (window, value->v.size_hints);
 
       spew_size_hints_differences (&old_hints, &window->size_hints);
 
diff --git a/src/core/xprops.c b/src/core/xprops.c
index 12a24d4d..1e325f2c 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -796,15 +796,14 @@ class_hint_from_results (GetPropertyResults *results,
 }
 
 static gboolean
-size_hints_from_results (GetPropertyResults *results,
-                         XSizeHints        **hints_p,
-                         gulong             *flags_p)
+size_hints_from_results (GetPropertyResults  *results,
+                         XSizeHints         **hints_p)
 {
   xPropSizeHints *raw;
   XSizeHints *hints;
+  gulong flags;
 
   *hints_p = NULL;
-  *flags_p = 0;
 
   if (!validate_or_free_results (results, 32, XA_WM_SIZE_HINTS, FALSE))
     return FALSE;
@@ -833,16 +832,16 @@ size_hints_from_results (GetPropertyResults *results,
   hints->max_aspect.x = cvtINT32toInt (raw->maxAspectX);
   hints->max_aspect.y = cvtINT32toInt (raw->maxAspectY);
 
-  *flags_p = (USPosition | USSize | PAllHints);
+  flags = (USPosition | USSize | PAllHints);
   if (results->n_items >= NumPropSizeElements)
     {
       hints->base_width= cvtINT32toInt (raw->baseWidth);
       hints->base_height= cvtINT32toInt (raw->baseHeight);
       hints->win_gravity= cvtINT32toInt (raw->winGravity);
-      *flags_p |= (PBaseSize | PWinGravity);
+      flags |= (PBaseSize | PWinGravity);
     }
 
-  hints->flags &= (*flags_p);  /* get rid of unwanted bits */
+  hints->flags &= flags; /* get rid of unwanted bits */
 
   XFree (results->prop);
   results->prop = NULL;
@@ -1098,9 +1097,7 @@ meta_prop_get_values (MetaDisplay   *display,
             values[i].type = META_PROP_VALUE_INVALID;
           break;
         case META_PROP_VALUE_SIZE_HINTS:
-          if (!size_hints_from_results (&results,
-                                        &values[i].v.size_hints.hints,
-                                        &values[i].v.size_hints.flags))
+          if (!size_hints_from_results (&results, &values[i].v.size_hints))
             values[i].type = META_PROP_VALUE_INVALID;
           break;
         case META_PROP_VALUE_SYNC_COUNTER:
@@ -1158,7 +1155,7 @@ free_value (MetaPropValue *value)
       meta_XFree (value->v.class_hint.res_name);
       break;
     case META_PROP_VALUE_SIZE_HINTS:
-      meta_XFree (value->v.size_hints.hints);
+      meta_XFree (value->v.size_hints);
       break;
     case META_PROP_VALUE_UTF8_LIST:
       g_strfreev (value->v.string_list.strings);
diff --git a/src/include/xprops.h b/src/include/xprops.h
index cb3f28d8..02179200 100644
--- a/src/include/xprops.h
+++ b/src/include/xprops.h
@@ -151,11 +151,7 @@ typedef struct
       int     n_counters;
     } xcounter_list;
 
-    struct
-    {
-      XSizeHints   *hints;
-      unsigned long flags;
-    } size_hints;
+    XSizeHints *size_hints;
 
     struct
     {


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