From: "Rodolfo García Peñas (kix)" <[email protected]>
The function get_pixmap_icon_from_wm_hints() is splitted in two
functions now:
1. get_rimage_icon_from_wm_hints, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_wm_hints() function, but now only converts
the icon->file_image in icon->pixmap
---
src/icon.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index f65fc84..6332afe 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -62,6 +62,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int
coord_y);
static void get_pixmap_icon_from_icon_win(WIcon *icon);
static int get_pixmap_icon_from_wm_hints(WIcon *icon);
+static int get_rimage_icon_from_wm_hints(WIcon *icon);
static void get_pixmap_icon_from_user_icon(WIcon *icon);
static void get_rimage_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
@@ -749,8 +750,8 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
None, wCursor[WCUR_ARROW]);
}
-/* Get the Pixmap from the XWindow wm_hints */
-static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+/* Get the RImage from the XWindow wm_hints */
+static int get_rimage_icon_from_wm_hints(WIcon *icon)
{
RImage *image = NULL;
unsigned int w, h, d;
@@ -765,9 +766,23 @@ static int get_pixmap_icon_from_wm_hints(WIcon *icon)
if (!image)
return 1;
- icon_update_pixmap(icon, image);
+ /* FIXME: If unset_icon_image, pointer double free then crash
+ unset_icon_image(icon); */
+ icon->file_image = image;
+
+ return 0;
+}
+
+/* Get the Pixmap from the XWindow wm_hints */
+static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+{
+ int ret;
+
+ ret = get_rimage_icon_from_wm_hints(icon);
+ if (ret == 0)
+ icon_update_pixmap(icon, icon->file_image);
- return 0;
+ return ret;
}
void wIconPaint(WIcon * icon)
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].