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

This function returns the image to be used in the windows as icon
If the window doesn't have any icon, returns NULL.

The function uses the NET_WM_ICON image if present, else the WM_HINTS image.
If the window doesn't have icon, then returns NULL.
---
 src/wmspec.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/wmspec.c b/src/wmspec.c
index 8fd91fa..41f1284 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -420,6 +420,25 @@ static RImage *makeRImageFromARGBData(unsigned long *data)
        return image;
 }
 
+/* This function returns the image to be used in the windows as icon
+ * If the window doesn't have any icon, returns NULL */
+RImage *get_window_image(WWindow *wwin)
+{
+       RImage *image = NULL;
+
+       /* First, get the image from the client (net_wm_icon) */
+       image = get_window_image_from_net_wm_icon(wwin->client_win);
+
+       /* If no image, get the image from the window hints */
+       if (!image)
+               image = get_wwindow_image_from_wm_hints(wwin);
+
+       if (image)
+               image = wIconValidateIconSize(image, wPreferences.icon_size);
+
+       return image;
+}
+
 RImage *get_wwindow_image_from_wm_hints(WWindow *wwin)
 {
        RImage *image = NULL;
-- 
1.7.10.4


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

Reply via email to