From 8cb744739c60441959973695c05c07fa56686430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Mon, 8 Apr 2013 19:40:56 +0200 Subject: [PATCH] Remove wIconUpdate in tileObserver The call to wIconUpdate() can be changed by call to update_icon_pixmap(), because the icon doesn't need to be changed. Now, the icon pixmap is updated faster. This change is more difficult to see, this is the explanation: 1. wIconUpdate() updates the icon for the applications, then call update_icon_pixmap() to re-create the pixmap. 2. tileObserver() is used if the event WNIconTileSettingsChanged() is launched. This event is used in the Notification for docks and wwindows: WMAddNotificationObserver(tileObserver, icon, WNIconTileSettingsChanged, icon); 3. The function WNIconTileSettingsChanged() is used if the icon need refresh, used in the wReadDefaults() function. See code below. This function is used in the wmaker startup. if (needs_refresh & REFRESH_ICON_TILE) WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL); 4. Finally, the flag to refresh the icon tile is throw by setIconTile(): return (reset ? REFRESH_ICON_TILE : 0); And this function only changes the the icon tile if reset is "1", that happend if src->icon_tile: if (scr->icon_tile) { reset = 1; RReleaseImage(scr->icon_tile); XFreePixmap(dpy, scr->icon_tile_pixmap); } 5. Then, we can drop the function wIconUpdate(), because the change is in the icon_tile variable, used only in icon_update_pixmap(). This function is only used in update_icon_pixmap() (not in wIconUpdate): kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep icon_tile icon.c tile = RCloneImage(scr->icon_tile); XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->icon_tile_pixmap); kix@kentin:~/src/wmaker/git/wmaker-crm/src$ static void icon_update_pixmap(WIcon *icon, RImage *image) { [snip] if (icon->tile_type == TILE_NORMAL) { tile = RCloneImage(scr->icon_tile); } else { assert(scr->clip_tile); tile = RCloneImage(scr->clip_tile); } [snip] The XSetWindowBackgroundPixmap() call doesn't matter here. --- src/icon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/icon.c b/src/icon.c index d5f857ca..94da6945 100644 --- a/src/icon.c +++ b/src/icon.c @@ -93,7 +93,7 @@ static void tileObserver(void *self, WMNotification *notif) { WIcon *icon = (WIcon *) self; - wIconUpdate(icon); + update_icon_pixmap(icon); XClearArea(dpy, icon->core->window, 0, 0, 1, 1, True); }