[mutter] xprops: More Xlib / long cleanliness with Motif WM hints



commit 6dbec6f81b5b147e47211f886f7fb1f92d078fa2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 24 14:34:48 2015 -0700

    xprops: More Xlib / long cleanliness with Motif WM hints
    
    Fixes some CSD windows sometimes getting frames when they totes
    shouldn't.

 src/x11/window-props.c |    4 ++--
 src/x11/xprops.c       |   30 ++++--------------------------
 src/x11/xprops.h       |   10 +++++-----
 3 files changed, 11 insertions(+), 33 deletions(-)
---
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 2bf83ef..17f5a3a 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -862,7 +862,7 @@ reload_mwm_hints (MetaWindow    *window,
 
   if (hints->flags & MWM_HINTS_DECORATIONS)
     {
-      meta_verbose ("Window %s sets MWM_HINTS_DECORATIONS 0x%lx\n",
+      meta_verbose ("Window %s sets MWM_HINTS_DECORATIONS 0x%x\n",
           window->desc, hints->decorations);
 
       if (hints->decorations == 0)
@@ -878,7 +878,7 @@ reload_mwm_hints (MetaWindow    *window,
     {
       gboolean toggle_value;
 
-      meta_verbose ("Window %s sets MWM_HINTS_FUNCTIONS 0x%lx\n",
+      meta_verbose ("Window %s sets MWM_HINTS_FUNCTIONS 0x%x\n",
                     window->desc, hints->functions);
 
       /* If _ALL is specified, then other flags indicate what to turn off;
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index fb9cc20..5fb5150 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -292,19 +292,11 @@ static gboolean
 motif_hints_from_results (GetPropertyResults *results,
                           MotifWmHints      **hints_p)
 {
-  int real_size, max_size;
-#define MAX_ITEMS sizeof (MotifWmHints)/sizeof (gulong)
-
   *hints_p = NULL;
 
   if (results->type == None || results->n_items <= 0)
     {
       meta_verbose ("Motif hints had unexpected type or n_items\n");
-      if (results->prop)
-        {
-          g_free (results->prop);
-          results->prop = NULL;
-        }
       return FALSE;
     }
 
@@ -312,26 +304,12 @@ motif_hints_from_results (GetPropertyResults *results,
    * MotifWmHints than the one we expect, apparently.  I'm not sure of
    * the history behind it. See bug #89841 for example.
    */
-  *hints_p = malloc (sizeof (MotifWmHints));
+  *hints_p = calloc (1, sizeof (MotifWmHints));
   if (*hints_p == NULL)
-    {
-      if (results->prop)
-        {
-          g_free (results->prop);
-          results->prop = NULL;
-        }
-      return FALSE;
-    }
-  real_size = results->n_items * sizeof (gulong);
-  max_size = MAX_ITEMS * sizeof (gulong);
-  memcpy (*hints_p, results->prop, MIN (real_size, max_size));
-
-  if (results->prop)
-    {
-      g_free (results->prop);
-      results->prop = NULL;
-    }
+    return FALSE;
 
+  memcpy(*hints_p, results->prop, MIN (sizeof (MotifWmHints),
+                                       results->n_items * sizeof (uint32_t)));
   return TRUE;
 }
 
diff --git a/src/x11/xprops.h b/src/x11/xprops.h
index 17a08ce..d52a90c 100644
--- a/src/x11/xprops.h
+++ b/src/x11/xprops.h
@@ -33,11 +33,11 @@
  * found in some Motif reference guides online.
  */
 typedef struct {
-    unsigned long flags;
-    unsigned long functions;
-    unsigned long decorations;
-    long input_mode;
-    unsigned long status;
+    uint32_t flags;
+    uint32_t functions;
+    uint32_t decorations;
+    uint32_t input_mode;
+    uint32_t status;
 } MotifWmHints, MwmHints;
 
 #define MWM_HINTS_FUNCTIONS     (1L << 0)


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