Remove wIconUpdate in tileObserver
commit8cb744739c60441959973695c05c07fa56686430
authorRodolfo García Peñas (kix) <kix@kix.es>
Mon, 8 Apr 2013 17:40:56 +0000 (8 19:40 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 8 Apr 2013 21:06:27 +0000 (8 22:06 +0100)
treefc5476c381bdfd1a1c96e8254b964d8b3409ceff
parentdee9c457cf16a52d6f27534e774959987a215ec1
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