[Xfce4-commits] r29408 - in xfwm4/trunk: . src

Olivier Fourdan olivier at xfce.org
Thu Jan 29 21:47:48 CET 2009


Author: olivier
Date: 2009-01-29 20:47:48 +0000 (Thu, 29 Jan 2009)
New Revision: 29408

Modified:
   xfwm4/trunk/ChangeLog
   xfwm4/trunk/NEWS
   xfwm4/trunk/src/events.c
Log:
	* src/events.c: Clear monitor cache when the screen size changes, but 
	  avoid redoing the work twice in the case of a monitor-changed event. 
 

Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog	2009-01-28 07:23:55 UTC (rev 29407)
+++ xfwm4/trunk/ChangeLog	2009-01-29 20:47:48 UTC (rev 29408)
@@ -1,3 +1,8 @@
+2009-01-29	olivier
+
+	* src/events.c: Clear monitor cache when the screen size changes, but 
+	  avoid redoing the work twice in the case of a monitor-changed event.
+
 2009-01-26	jannis
 
 	* == 4.5.99.1 released! ==

Modified: xfwm4/trunk/NEWS
===================================================================
--- xfwm4/trunk/NEWS	2009-01-28 07:23:55 UTC (rev 29407)
+++ xfwm4/trunk/NEWS	2009-01-29 20:47:48 UTC (rev 29408)
@@ -1,3 +1,8 @@
+4.6.0?
+=====
+
+- Fix possible monitor cache size inconsistency when the screen size changes
+
 4.5.99.1 (Xfce 4.6rc1)
 ======================
 

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2009-01-28 07:23:55 UTC (rev 29407)
+++ xfwm4/trunk/src/events.c	2009-01-29 20:47:48 UTC (rev 29408)
@@ -2724,17 +2724,43 @@
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
+    int new_width, new_height;
 
     TRACE ("entering size_changed_cb");
 
     screen_info = (ScreenInfo *) data;
     g_return_if_fail (screen_info);
 
+    /*
+     * We have added/removed a monitor or even changed the layout,
+     * the cache for monitor position we use in our screen structure
+     * is not valid anymore and potentially refers to a monitor that
+     * was just removed, so invalidate it.
+     */
+    screen_info->cache_monitor.x = -1;
+    screen_info->cache_monitor.y = -1;
+    screen_info->cache_monitor.width = 0;
+    screen_info->cache_monitor.height = 0;
+
+    /*
+     * If the overall size of the screen hasn't changed,
+     * there is no need to continue any further...
+     */
+    new_width  = WidthOfScreen (screen_info->xscreen);
+    new_height = HeightOfScreen (screen_info->xscreen);
+
+    if ((screen_info->width  == new_width) &&
+        (screen_info->height == new_height))
+    {
+        return;
+    }
+
     display_info = screen_info->display_info;
-    screen_info->width = WidthOfScreen (screen_info->xscreen);
-    screen_info->height = HeightOfScreen (screen_info->xscreen);
+    screen_info->width = new_width;
+    screen_info->height = new_height;
+
     setNetWorkarea (display_info, screen_info->xroot, screen_info->workspace_count,
-                    screen_info->width, screen_info->height, screen_info->margins);
+                    new_width, new_height, screen_info->margins);
     placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
     clientScreenResize (screen_info);
     compositorUpdateScreenSize (screen_info);
@@ -2750,16 +2776,6 @@
     screen_info = (ScreenInfo *) data;
     g_return_if_fail (screen_info);
 
-    /* We have added/removed a monitor or even changed the layout,
-     * the cache for monitor position we use in our screen structure
-     * is not valid anymore and potentially refers to a monitor that
-     * was just removed, so invalidate it.
-     */
-    screen_info->cache_monitor.x = -1;
-    screen_info->cache_monitor.y = -1;
-    screen_info->cache_monitor.width = 0;
-    screen_info->cache_monitor.height = 0;
-
     /*
      * From the window manager point of view,
      * a XRand 1.2 monitor change is similar to




More information about the Xfce4-commits mailing list