From fd9bb936aa9379c27ba3bbf0c1fdb6c0ed1626cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 3 Nov 2012 19:54:07 +0100 Subject: [PATCH] appearanceObserver doesn't create icon again The function appearanceObserver() is now faster because it doesn't re-create the icon. Now it only draws the icon pixmap. --- src/icon.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/icon.c b/src/icon.c index 2980db8e..f82be538 100644 --- a/src/icon.c +++ b/src/icon.c @@ -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 */