]> Pileus Git - ~andy/gtk/commitdiff
Use XAllocSizeHints to allocate the XSizeHints struct. (#249285, David
authorMatthias Clasen <mclasen@redhat.com>
Tue, 15 Aug 2006 05:53:58 +0000 (05:53 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 15 Aug 2006 05:53:58 +0000 (05:53 +0000)
2006-08-15  Matthias Clasen  <mclasen@redhat.com>

        * gdk/x11/gdkwindow-x11.c (gdk_window_get_geometry_hints):
        Use XAllocSizeHints to allocate the XSizeHints struct.
        (#249285, David Baron)

ChangeLog
ChangeLog.pre-2-10
gdk/x11/gdkwindow-x11.c

index c1fd3dacaed8cc87ee743f07e142045351f325bf..8de472d0f4dc3b3b6d7b749a0c69ba870b950f21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-08-15  Matthias Clasen  <mclasen@redhat.com>
 
+       * gdk/x11/gdkwindow-x11.c (gdk_window_get_geometry_hints):
+       Use XAllocSizeHints to allocate the XSizeHints struct.
+       (#249285, David Baron)
+
        * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd):
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_decorations):
        (gdk_window_set_functions): Zero out some stack-allocated
index c1fd3dacaed8cc87ee743f07e142045351f325bf..8de472d0f4dc3b3b6d7b749a0c69ba870b950f21 100644 (file)
@@ -1,5 +1,9 @@
 2006-08-15  Matthias Clasen  <mclasen@redhat.com>
 
+       * gdk/x11/gdkwindow-x11.c (gdk_window_get_geometry_hints):
+       Use XAllocSizeHints to allocate the XSizeHints struct.
+       (#249285, David Baron)
+
        * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd):
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_decorations):
        (gdk_window_set_functions): Zero out some stack-allocated
index 2a71b22ada3f302c5e439679ed40f6c00268d2f8..ccb05af0787c1b9357f6e4b3176595eb6318a20e 100644 (file)
@@ -2659,8 +2659,8 @@ gdk_window_get_geometry_hints (GdkWindow      *window,
                                GdkGeometry    *geometry,
                                GdkWindowHints *geom_mask)
 {
-  XSizeHints size_hints;  
-  glong junk_size_mask = 0;
+  XSizeHints *size_hints;  
+  glong junk_supplied_mask = 0;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
   g_return_if_fail (geometry != NULL);
@@ -2670,47 +2670,53 @@ gdk_window_get_geometry_hints (GdkWindow      *window,
   
   if (GDK_WINDOW_DESTROYED (window))
     return;
+
+  size_hints = XAllocSizeHints ();
+  if (!size_hints)
+    return;
   
   if (!XGetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
                           GDK_WINDOW_XID (window),
-                          &size_hints,
-                          &junk_size_mask))
-    return;                   
+                          size_hints,
+                          &junk_supplied_mask))
+    size_hints->flags = 0;
 
-  if (size_hints.flags & PMinSize)
+  if (size_hints->flags & PMinSize)
     {
       *geom_mask |= GDK_HINT_MIN_SIZE;
-      geometry->min_width = size_hints.min_width;
-      geometry->min_height = size_hints.min_height;
+      geometry->min_width = size_hints->min_width;
+      geometry->min_height = size_hints->min_height;
     }
 
-  if (size_hints.flags & PMaxSize)
+  if (size_hints->flags & PMaxSize)
     {
       *geom_mask |= GDK_HINT_MAX_SIZE;
-      geometry->max_width = MAX (size_hints.max_width, 1);
-      geometry->max_height = MAX (size_hints.max_height, 1);
+      geometry->max_width = MAX (size_hints->max_width, 1);
+      geometry->max_height = MAX (size_hints->max_height, 1);
     }
 
-  if (size_hints.flags & PResizeInc)
+  if (size_hints->flags & PResizeInc)
     {
       *geom_mask |= GDK_HINT_RESIZE_INC;
-      geometry->width_inc = size_hints.width_inc;
-      geometry->height_inc = size_hints.height_inc;
+      geometry->width_inc = size_hints->width_inc;
+      geometry->height_inc = size_hints->height_inc;
     }
 
-  if (size_hints.flags & PAspect)
+  if (size_hints->flags & PAspect)
     {
       *geom_mask |= GDK_HINT_ASPECT;
 
-      geometry->min_aspect = (gdouble) size_hints.min_aspect.x / (gdouble) size_hints.min_aspect.y;
-      geometry->max_aspect = (gdouble) size_hints.max_aspect.x / (gdouble) size_hints.max_aspect.y;
+      geometry->min_aspect = (gdouble) size_hints->min_aspect.x / (gdouble) size_hints->min_aspect.y;
+      geometry->max_aspect = (gdouble) size_hints->max_aspect.x / (gdouble) size_hints->max_aspect.y;
     }
 
-  if (size_hints.flags & PWinGravity)
+  if (size_hints->flags & PWinGravity)
     {
       *geom_mask |= GDK_HINT_WIN_GRAVITY;
-      geometry->win_gravity = size_hints.win_gravity;
+      geometry->win_gravity = size_hints->win_gravity;
     }
+
+  XFree (size_hints);
 }
 
 static gboolean