From ceedad4231e5370f8e687bdbaeb513e6cfe9108c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 3 Nov 2012 19:53:58 +0100 Subject: [PATCH] Split get_pixmap_icon_from_wm_hints() into two 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 a94b4b2a..3e46f04a 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) -- 2.11.4.GIT