[Xfce4-commits] r24046 - xfwm4/trunk/src

Olivier Fourdan olivier at xfce.org
Mon Dec 4 21:31:24 CET 2006


Author: olivier
Date: 2006-12-04 20:31:24 +0000 (Mon, 04 Dec 2006)
New Revision: 24046

Modified:
   xfwm4/trunk/src/compositor.c
   xfwm4/trunk/src/events.c
Log:
Plug a huge X resources leak in handleMappingNotify () (bug #2618)

Modified: xfwm4/trunk/src/compositor.c
===================================================================
--- xfwm4/trunk/src/compositor.c	2006-12-04 19:10:35 UTC (rev 24045)
+++ xfwm4/trunk/src/compositor.c	2006-12-04 20:31:24 UTC (rev 24046)
@@ -67,7 +67,7 @@
 #define WIN_HAS_CLIENT(cw)              (cw->c)
 #define WIN_HAS_FRAME(cw)               (WIN_HAS_CLIENT(cw) && FLAG_TEST (cw->c->xfwm_flags, XFWM_FLAG_HAS_BORDER) && \
                                          !FLAG_TEST (cw->c->flags, CLIENT_FLAG_FULLSCREEN))
-#define WIN_NO_SHADOW(cw)               ((cw->c) &&  FLAG_TEST (cw->c->flags, CLIENT_FLAG_FULLSCREEN | CLIENT_FLAG_BELOW))
+#define WIN_NO_SHADOW(cw)               ((cw->c) && FLAG_TEST (cw->c->flags, CLIENT_FLAG_FULLSCREEN | CLIENT_FLAG_BELOW))
 #define WIN_IS_OVERRIDE(cw)             (cw->attr.override_redirect)
 #define WIN_IS_ARGB(cw)                 (cw->argb)
 #define WIN_IS_OPAQUE(cw)               (((cw->opacity == NET_WM_OPAQUE) && !WIN_IS_ARGB(cw)) || (cw->screen_info->overlays))
@@ -724,22 +724,16 @@
         cw->alphaBorderPict = None;
     }
 
-    if (cw->clientSize)
-    {
-        XFixesDestroyRegion (display_info->dpy, cw->clientSize);
-        cw->clientSize = None;
-    }
-
     if (cw->borderSize)
     {
         XFixesDestroyRegion (display_info->dpy, cw->borderSize);
         cw->borderSize = None;
     }
 
-    if (cw->extents)
+    if (cw->clientSize)
     {
-        XFixesDestroyRegion (display_info->dpy, cw->extents);
-        cw->extents = None;
+        XFixesDestroyRegion (display_info->dpy, cw->clientSize);
+        cw->clientSize = None;
     }
 
     if (cw->borderClip)
@@ -748,9 +742,15 @@
         cw->borderClip = None;
     }
 
+    if (cw->extents)
+    {
+        XFixesDestroyRegion (display_info->dpy, cw->extents);
+        cw->extents = None;
+    }
+
     if (delete)
     {
-        if (cw->damage != None)
+        if (cw->damage)
         {
             XDamageDestroy (display_info->dpy, cw->damage);
             cw->damage = None;
@@ -2009,16 +2009,6 @@
 }
 
 static void
-set_size_attributes (CWindow *cw, gint x, gint y, gint width, gint height, gint bw)
-{
-    cw->attr.x = x;
-    cw->attr.y = y;
-    cw->attr.width = width;
-    cw->attr.height = height;
-    cw->attr.border_width = bw;
-}
-
-static void
 resize_win (CWindow *cw, gint x, gint y, gint width, gint height, gint bw, gboolean shape_notify)
 {
     DisplayInfo *display_info;
@@ -2031,11 +2021,19 @@
 
     screen_info = cw->screen_info;
     display_info = screen_info->display_info;
+    damage = None;
 
-    damage = XFixesCreateRegion (display_info->dpy, NULL, 0);
+    if (WIN_IS_VISIBLE(cw))
+    {
+        damage = XFixesCreateRegion (display_info->dpy, NULL, 0);
+        if (cw->extents)
+        {
+            XFixesCopyRegion (display_info->dpy, damage, cw->extents);
+        }
+    }
+
     if (cw->extents)
     {
-        XFixesCopyRegion (display_info->dpy, damage, cw->extents);
         XFixesDestroyRegion (display_info->dpy, cw->extents);
         cw->extents = None;
     }
@@ -2082,25 +2080,26 @@
         }
     }
 
-    set_size_attributes (cw, x, y, width, height, bw);
+    cw->attr.x = x;
+    cw->attr.y = y;
+    cw->attr.width = width;
+    cw->attr.height = height;
+    cw->attr.border_width = bw;
 
-    if (!WIN_IS_VISIBLE(cw))
+    if (damage)
     {
-        /* 'nuff for invisible windows... */
-        return;
+        cw->extents = win_extents (cw);
+        XFixesUnionRegion (display_info->dpy, damage, damage, cw->extents);
+        /* A shape notify will likely change the shadows too, so clear the extents */
+        if (shape_notify)
+        {
+            XFixesDestroyRegion (display_info->dpy, cw->extents);
+            cw->extents = None;
+        }
+        fix_region (cw, damage);
+        /* damage region will be destroyed by add_damage () */
+        add_damage (screen_info, damage);
     }
-
-    cw->extents = win_extents (cw);
-    XFixesUnionRegion (display_info->dpy, damage, damage, cw->extents);
-    /* A shape notify will likely change the shadows too, so clear the extents */
-    if (shape_notify)
-    {
-        XFixesDestroyRegion (display_info->dpy, cw->extents);
-        cw->extents = None;
-    }
-    fix_region (cw, damage);
-    /* damage region will be destroyed by add_damage () */
-    add_damage (screen_info, damage);
 }
 
 static void

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2006-12-04 19:10:35 UTC (rev 24045)
+++ xfwm4/trunk/src/events.c	2006-12-04 20:31:24 UTC (rev 24046)
@@ -2189,8 +2189,6 @@
 static void
 handleMappingNotify (DisplayInfo *display_info, XMappingEvent * ev)
 {
-    GSList *screens;
-
     TRACE ("entering handleMappingNotify");
 
     /* Refreshes the stored modifier and keymap information */
@@ -2206,20 +2204,8 @@
     /* Regrab all keys if the notify is for keyboard (ie not pointer) */
     if (ev->request != MappingPointer)
     {
-        TRACE ("handleMappingNotify: Regrab keys");
-        for (screens = display_info->screens; screens; screens = g_slist_next (screens))
-        {
-            ScreenInfo *screen_info = (ScreenInfo *) screens->data;
-
-            /* We need to reload all the settings to recompute the key bindings... */
-            loadSettings (screen_info);
-
-            /* ...then update all frames grabs... */
-            clientUpdateAllFrames (screen_info, UPDATE_BUTTON_GRABS);
-
-            /* ...and regrab the keys we have on the root win... */
-            myScreenGrabKeys (screen_info);
-        }
+        TRACE ("handleMappingNotify: Reload settings");
+        reloadSettings (display_info, UPDATE_BUTTON_GRABS);
     }
 }
 



More information about the Xfce4-commits mailing list