From: "Rodolfo García Peñas (kix)" <k...@kix.es> The functions get_wwindow_image_from_wmhints() and get_rimage_icon_from_wm_hints() uses now argument more strict.
get_rimage_icon_from_wm_hints: -RImage *get_rimage_icon_from_wm_hints(WIcon *icon) +RImage *get_rimage_icon_from_wm_hints(WWindow *wwin) This function returns the image from window, so the argument should be Window or WWindow (not WIcon). In this case is better WWindow, because we can use WScreen or other arguments. get_wwindow_image_from_wmhints: -static RImage *get_wwindow_image_from_wmhints(WWindow *wwin, WIcon *icon) +static RImage *get_wwindow_image_from_wm_hints(WWindow *wwin) The function get_wwindow_image_from_wmhints, renamed to get_wwindow_image_from_wm_hints to hold the same pattern name that get_rimage_icon_from_wm_hints, only needs the WWindow to get the RImage, so now the interface is easier. --- src/icon.c | 15 +++++++-------- src/icon.h | 2 +- src/winspector.c | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/icon.c b/src/icon.c index ee441cd..7119a26 100644 --- a/src/icon.c +++ b/src/icon.c @@ -464,13 +464,13 @@ static char *get_icon_cache_path(void) return NULL; } -static RImage *get_wwindow_image_from_wmhints(WWindow *wwin, WIcon *icon) +static RImage *get_wwindow_image_from_wm_hints(WWindow *wwin) { RImage *image = NULL; XWMHints *hints = wwin->wm_hints; if (hints && (hints->flags & IconPixmapHint) && hints->icon_pixmap != None) - image = RCreateImageFromDrawable(icon->core->screen_ptr->rcontext, + image = RCreateImageFromDrawable(wwin->screen_ptr->rcontext, hints->icon_pixmap, (hints->flags & IconMaskHint) ? hints->icon_mask : None); @@ -520,7 +520,7 @@ char *wIconStore(WIcon * icon) if (wwin->net_icon_image) image = RRetainImage(wwin->net_icon_image); else - image = get_wwindow_image_from_wmhints(wwin, icon); + image = get_wwindow_image_from_wm_hints(wwin); if (!image) { wfree(path); @@ -617,7 +617,7 @@ void wIconUpdate(WIcon *icon, RImage *image) } else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & IconPixmapHint)) { /* Get the Pixmap from the wm_hints, else, from the user */ unset_icon_image(icon); - icon->file_image = get_rimage_icon_from_wm_hints(icon); + icon->file_image = get_rimage_icon_from_wm_hints(icon->owner); if (!icon->file_image) get_rimage_icon_from_user_icon(icon); } else { @@ -743,18 +743,17 @@ static void set_dockapp_in_icon(WIcon *icon) } /* Get the RImage from the XWindow wm_hints */ -RImage *get_rimage_icon_from_wm_hints(WIcon *icon) +RImage *get_rimage_icon_from_wm_hints(WWindow *wwin) { RImage *image = NULL; unsigned int w, h, d; - WWindow *wwin = icon->owner; if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) { - icon->owner->wm_hints->flags &= ~IconPixmapHint; + wwin->wm_hints->flags &= ~IconPixmapHint; return NULL; } - image = get_wwindow_image_from_wmhints(wwin, icon); + image = get_wwindow_image_from_wm_hints(wwin); if (!image) return NULL; diff --git a/src/icon.h b/src/icon.h index c2a6b09..696a20d 100644 --- a/src/icon.h +++ b/src/icon.h @@ -66,7 +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); +RImage *get_rimage_icon_from_wm_hints(WWindow *wwin); char *wIconStore(WIcon *icon); char *get_name_for_instance_class(char *wm_instance, char *wm_class); diff --git a/src/winspector.c b/src/winspector.c index 7335030..4e31dd3 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -759,11 +759,11 @@ static void applySettings(WMButton *button, InspectorPanel *panel) } else { /* Change App Icon image */ if (wapp->app_icon) - wIconUpdate(wapp->app_icon->icon, get_rimage_icon_from_wm_hints(wapp->app_icon->icon)); + wIconUpdate(wapp->app_icon->icon, get_rimage_icon_from_wm_hints(wapp->app_icon->icon->owner)); /* Change icon image if the app is minimized */ if (wwin->icon) - wIconUpdate(wwin->icon, get_rimage_icon_from_wm_hints(wwin->icon)); + wIconUpdate(wwin->icon, get_rimage_icon_from_wm_hints(wwin->icon->owner)); } if (file) -- 1.7.10.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.