From: "Rodolfo García Peñas (kix)" <[email protected]>

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. 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 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 51dcd41..ce97b26 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -463,13 +463,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);
@@ -519,7 +519,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);
@@ -623,7 +623,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(wwin);
                        if (!icon->file_image)
                                get_rimage_icon_from_user_icon(icon);
                } else {
@@ -741,18 +741,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);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to