From: "Rodolfo García Peñas (kix)" <[email protected]>

The function wIconChangeTitle() is now faster, because don't
re-create the icon. Now only draw the icon pixmap.
---
 src/icon.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 8d9b52a..7903290 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -337,21 +337,25 @@ static void icon_update_pixmap(WIcon *icon, RImage *image)
        icon->pixmap = pixmap;
 }
 
-void wIconChangeTitle(WIcon * icon, char *new_title)
+void wIconChangeTitle(WIcon *icon, char *new_title)
 {
        int changed;
 
-       changed = (new_title == NULL && icon->icon_name != NULL)
-           || (new_title != NULL && icon->icon_name == NULL);
+       changed = (new_title == NULL && icon->icon_name != NULL) ||
+                 (new_title != NULL && icon->icon_name == NULL);
 
        if (icon->icon_name != NULL)
                XFree(icon->icon_name);
 
        icon->icon_name = new_title;
 
-       if (changed)
-               icon->force_paint = 1;
-       wIconPaint(icon);
+       if (changed) {
+               /* If the rimage exists, update the icon, else create it */
+               if (icon->file_image)
+                       update_icon_pixmap(icon);
+               else
+                       wIconPaint(icon);
+       }
 }
 
 RImage *wIconValidateIconSize(RImage *icon, int max_size)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to