get_rimage_icon_from_wm_hints returns image
authorRodolfo García Peñas (kix) <kix@kix.es>
Wed, 14 Nov 2012 23:44:00 +0000 (15 00:44 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 17 Nov 2012 20:10:24 +0000 (17 21:10 +0100)
The function get_rimage_icon_from_wm_hints now returns an image.

src/icon.c
src/icon.h

index f1f9c67..13a0c94 100644 (file)
@@ -62,7 +62,6 @@ 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 int get_rimage_icon_from_wm_hints(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
 static void get_rimage_icon_from_default_icon(WIcon *icon);
 static void get_rimage_icon_from_x11(WIcon *icon);
@@ -617,7 +616,9 @@ void wIconUpdate(WIcon *icon, RImage *image)
                        get_rimage_icon_from_x11(icon);
                } else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & IconPixmapHint)) {
                        /* Get the Pixmap from the wm_hints, else, from the user */
-                       if (get_rimage_icon_from_wm_hints(icon))
+                       unset_icon_image(icon);
+                       icon->file_image = get_rimage_icon_from_wm_hints(icon);
+                       if (!icon->file_image)
                                get_rimage_icon_from_user_icon(icon);
                } else {
                        /* Get the Pixmap from the user */
@@ -746,7 +747,7 @@ static void set_dockapp_in_icon(WIcon *icon)
 }
 
 /* Get the RImage from the XWindow wm_hints */
-static int get_rimage_icon_from_wm_hints(WIcon *icon)
+RImage *get_rimage_icon_from_wm_hints(WIcon *icon)
 {
        RImage *image = NULL;
        unsigned int w, h, d;
@@ -754,20 +755,17 @@ static int get_rimage_icon_from_wm_hints(WIcon *icon)
 
        if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) {
                icon->owner->wm_hints->flags &= ~IconPixmapHint;
-               return 1;
+               return NULL;
        }
 
        image = get_wwindow_image_from_wmhints(wwin, icon);
        if (!image)
-               return 1;
+               return NULL;
 
        /* Resize the icon to the wPreferences.icon_size size */
        image = wIconValidateIconSize(image, wPreferences.icon_size);
 
-       unset_icon_image(icon);
-       icon->file_image = image;
-
-       return 0;
+       return image;
 }
 
 void wIconPaint(WIcon *icon)
index 74e6211..c2a6b09 100644 (file)
@@ -66,6 +66,7 @@ void update_icon_pixmap(WIcon *icon);
 Bool wIconChangeImageFile(WIcon *icon, char *file);
 
 RImage *wIconValidateIconSize(RImage *icon, int max_size);
+RImage *get_rimage_icon_from_wm_hints(WIcon *icon);
 
 char *wIconStore(WIcon *icon);
 char *get_name_for_instance_class(char *wm_instance, char *wm_class);