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

The current function:

-static void get_rimage_icon_from_default_icon(WIcon *icon);

needs an icon to get the default image. This patch changes the
behaviour. Now the function to return the default icon is:

+static RImage *get_default_icon_rimage(WScreen *scr);

Then, is possible to call this function using only the WScreen,
without icon.

This function is only used (by now) in get_rimage_icon_from_user_icon()
therefore, this function must clean the icon image struct before
set the new image.
---
 src/icon.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 13a0c94..ee441cd 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,7 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 static void set_dockapp_in_icon(WIcon *icon);
 static void get_rimage_icon_from_icon_win(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
-static void get_rimage_icon_from_default_icon(WIcon *icon);
+static RImage *get_default_icon_rimage(WScreen *scr);
 static void get_rimage_icon_from_x11(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
@@ -670,22 +670,18 @@ static void get_rimage_icon_from_user_icon(WIcon *icon)
        if (icon->file_image)
                return;
 
-       get_rimage_icon_from_default_icon(icon);
+       unset_icon_image(icon);
+       icon->file_image = get_default_icon_rimage(icon->core->screen_ptr);
 }
 
-static void get_rimage_icon_from_default_icon(WIcon *icon)
+static RImage *get_default_icon_rimage(WScreen *scr)
 {
-       WScreen *scr = icon->core->screen_ptr;
-
        /* If the icon don't have image, we should use the default image. */
        if (!scr->def_icon_rimage)
                scr->def_icon_rimage = get_default_image(scr);
 
-       /* Remove the icon image */
-       unset_icon_image(icon);
-
-       /* Set the new icon image */
-       icon->file_image = RRetainImage(scr->def_icon_rimage);
+       /* Return the default icon image */
+       return RRetainImage(scr->def_icon_rimage);
 }
 
 /* Get the RImage from the WIcon of the WWindow */
-- 
1.7.10.4


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

Reply via email to