>From 2aa00a7705b276c22961b115ba35503984766351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:44:00 +0100
Subject: [PATCH 5/6] get_rimage_icon_from_wm_hints returns image

The function get_rimage_icon_from_wm_hints now returns an image.
---
 src/icon.c |   16 +++++++---------
 src/icon.h |    2 ++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index bc466f9..e63086d 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -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);
@@ -619,7 +618,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 */
@@ -748,7 +749,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;
@@ -756,20 +757,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)
diff --git a/src/icon.h b/src/icon.h
index a3f538b..9709b6a 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -70,6 +70,8 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size);
 char *wIconStore(WIcon *icon);
 char *get_name_for_instance_class(char *wm_instance, char *wm_class);
 
+RImage *get_rimage_icon_from_wm_hints(WIcon *icon);
+
 #ifdef NEWAPPICON
 void wIconSetHighlited(WIcon *icon, Bool flag);
 #endif /* NEWAPPICON */
-- 
1.7.10.4

>From 2aa00a7705b276c22961b115ba35503984766351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:44:00 +0100
Subject: [PATCH 5/6] get_rimage_icon_from_wm_hints returns image

The function get_rimage_icon_from_wm_hints now returns an image.
---
 src/icon.c |   16 +++++++---------
 src/icon.h |    2 ++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index bc466f9..e63086d 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -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);
@@ -619,7 +618,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 */
@@ -748,7 +749,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;
@@ -756,20 +757,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)
diff --git a/src/icon.h b/src/icon.h
index a3f538b..9709b6a 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -70,6 +70,8 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size);
 char *wIconStore(WIcon *icon);
 char *get_name_for_instance_class(char *wm_instance, char *wm_class);
 
+RImage *get_rimage_icon_from_wm_hints(WIcon *icon);
+
 #ifdef NEWAPPICON
 void wIconSetHighlited(WIcon *icon, Bool flag);
 #endif /* NEWAPPICON */
-- 
1.7.10.4

Reply via email to