From: Rodolfo García Peñas (kix) Date: Wed, 14 Nov 2012 23:44:00 +0000 (+0100) Subject: get_rimage_icon_from_wm_hints returns image X-Git-Tag: wmaker-0.95.4~21 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/3f2c87fb06487072444f856cd609122686b7edf3 get_rimage_icon_from_wm_hints returns image The function get_rimage_icon_from_wm_hints now returns an image. --- diff --git a/src/icon.c b/src/icon.c index f1f9c67d..13a0c948 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); @@ -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) diff --git a/src/icon.h b/src/icon.h index 74e6211a..c2a6b098 100644 --- a/src/icon.h +++ b/src/icon.h @@ -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);