appearanceObserver doesn't create icon again
authorRodolfo García Peñas (kix) <kix@kix.es>
Sat, 3 Nov 2012 18:54:07 +0000 (3 19:54 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 4 Nov 2012 12:54:16 +0000 (4 12:54 +0000)
The function appearanceObserver() is now faster because it doesn't
re-create the icon. Now it only draws the icon pixmap.

src/icon.c

index 2980db8..f82be53 100644 (file)
@@ -72,15 +72,18 @@ static void unset_icon_image(WIcon *icon);
 
 /****** Notification Observers ******/
 
-static void appearanceObserver(void *self, WMNotification * notif)
+static void appearanceObserver(void *self, WMNotification *notif)
 {
        WIcon *icon = (WIcon *) self;
        uintptr_t flags = (uintptr_t)WMGetNotificationClientData(notif);
 
-       if ((flags & WTextureSettings) || (flags & WFontSettings))
-               icon->force_paint = 1;
-
-       wIconPaint(icon);
+       if ((flags & WTextureSettings) || (flags & WFontSettings)) {
+               /* If the rimage exists, update the icon, else create it */
+               if (icon->file_image)
+                       update_icon_pixmap(icon);
+               else
+                       wIconPaint(icon);
+       }
 
        /* so that the appicon expose handlers will paint the appicon specific
         * stuff */