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

Olivier Fourdan olivier at xfce.org
Tue Dec 19 22:37:16 CET 2006


Author: olivier
Date: 2006-12-19 21:37:16 +0000 (Tue, 19 Dec 2006)
New Revision: 24141

Modified:
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/client.h
   xfwm4/trunk/src/events.c
Log:
Update application icon asynchronously to avoid queuing useless icon updates (Ubuntu/Launchpad bug #61424)

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c	2006-12-19 19:36:18 UTC (rev 24140)
+++ xfwm4/trunk/src/client.c	2006-12-19 21:37:16 UTC (rev 24141)
@@ -1259,6 +1259,10 @@
     {
         g_source_remove (c->blink_timeout_id);
     }
+    if (c->icon_timeout_id)
+    {
+        g_source_remove (c->icon_timeout_id);
+    }
     if (c->name)
     {
         g_free (c->name);
@@ -1503,8 +1507,8 @@
     }
 }
 
-void
-clientUpdateIcon (Client * c)
+static void
+clientUpdateIconPix (Client * c)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -1514,6 +1518,8 @@
     g_return_if_fail (c != NULL);
     g_return_if_fail (c->window != None);
 
+    TRACE ("entering clientUpdateIconPix for \"%s\" (0x%lx)", c->name, c->window);
+
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
@@ -1549,6 +1555,37 @@
     }
 }
 
+static gboolean
+update_icon_idle_cb (gpointer data)
+{
+    Client *c;
+    
+    TRACE ("entering update_icon_idle_cb");
+
+    c = (Client *) data;
+    g_return_val_if_fail (c, FALSE);
+
+    clientUpdateIconPix (c);
+    frameDraw (c, TRUE);
+    c->icon_timeout_id = 0;
+
+    return FALSE;
+}
+
+void
+clientUpdateIcon (Client * c)
+{
+    g_return_if_fail (c);
+
+    TRACE ("entering clientUpdateIcon for \"%s\" (0x%lx)", c->name, c->window);
+
+    if (c->icon_timeout_id == 0)
+    {
+        c->icon_timeout_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, 
+                                              update_icon_idle_cb, c, NULL);
+    }
+}
+
 Client *
 clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
 {
@@ -1713,6 +1750,8 @@
 
     c->opacity_locked = getOpacityLock (display_info, c->window);
 
+    /* Timout for asynchronous icon update */
+    c->icon_timeout_id = 0;
     /* Timeout for blinking on urgency */
     c->blink_timeout_id = 0;
 

Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h	2006-12-19 19:36:18 UTC (rev 24140)
+++ xfwm4/trunk/src/client.h	2006-12-19 21:37:16 UTC (rev 24141)
@@ -275,6 +275,8 @@
     unsigned long flags;
     unsigned long wm_flags;
     unsigned long xfwm_flags;
+    /* Timout for asynchronous icon update */
+    guint icon_timeout_id;
     /* Timout to manage blinking decorations for urgent windows */
     guint blink_timeout_id;
     /* Opacity for the compositor */

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2006-12-19 19:36:18 UTC (rev 24140)
+++ xfwm4/trunk/src/events.c	2006-12-19 21:37:16 UTC (rev 24141)
@@ -1249,14 +1249,18 @@
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
 
+    TRACE ("entering update_screen_idle_cb");
+
     screen_info = (ScreenInfo *) data;
+    g_return_val_if_fail (screen_info, FALSE);
+
     display_info = screen_info->display_info;
-
     setNetWorkarea (display_info, screen_info->xroot, screen_info->workspace_count,
                     screen_info->width, screen_info->height, screen_info->margins);
     placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
     clientScreenResize (screen_info);
     compositorUpdateScreenSize (screen_info);
+
     return FALSE;
 }
 
@@ -1833,7 +1837,6 @@
                 if ((c->wmhints->flags & IconPixmapHint) && (screen_info->params->show_app_icon))
                 {
                     clientUpdateIcon (c);
-                    frameDraw (c, TRUE);
                 }
                 if (HINTS_ACCEPT_INPUT (c->wmhints))
                 {
@@ -1938,7 +1941,6 @@
                   (ev->atom == display_info->atoms[KWM_WIN_ICON])))
         {
             clientUpdateIcon (c);
-            frameDraw (c, TRUE);
         }
 #ifdef HAVE_STARTUP_NOTIFICATION
         else if (ev->atom == display_info->atoms[NET_STARTUP_ID])



More information about the Xfce4-commits mailing list