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

The function wIconChangeTitle is rewritten. Changes are:

1. Changed flag removed.

The changed flag check if:

* new_title == NULL and the icon->icon_name not.
* new_title is not NULL and the icon->icon name yes.

This can be used if the title is created or removed, not changed.
For example, if we lauch "xterm" it show in the title the current
path. If we change the path, the title changes, but changed is
0, because:

new_title != NULL and icon->icon_name != NULL.

You can check this issue with this steps:

1. Open a xterm (or other app that changes the title)
2. Type in the xterm "sleep 5; cd /"
3. Minimize the xterm and see the title. 5 seconds later, it change

Without this patch, in step 3, the icon title doesn't change.

2. wIconUpdate removed

The function wIconChangeTitle() function calls wIconUpdate() or
wIconPaint() depending of changed. In both cases the icon->file_image
doesn't change, only the icon title, so we can use the same image
and we don't need update it. Because the variable changed is removed,
we can use wIconPaint() here.
---
 src/icon.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index ab0e690..0aa29b8 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -335,20 +335,15 @@ static void icon_update_pixmap(WIcon *icon, RImage *image)
 
 void wIconChangeTitle(WIcon *icon, char *new_title)
 {
-       int changed;
-
-       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)
-               wIconUpdate(icon, NULL);
-       else
-               wIconPaint(icon);
+       /* If the title change, then we must re-create the icon with
+        * the new title, but we can still continue with the same icon
+        * therefore, we need only re-paint with the new title. */
+       wIconPaint(icon);
 }
 
 RImage *wIconValidateIconSize(RImage *icon, int max_size)
-- 
1.7.10.4


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

Reply via email to