Make get_wwindow_image_from_x11() take Window as argument
authorRodolfo García Peñas (kix) <kix@kix.es>
Sat, 3 Nov 2012 18:54:00 +0000 (3 19:54 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 4 Nov 2012 00:35:36 +0000 (4 00:35 +0000)
The function get_wwindow_image_from_x11() is renamed to get_window_image_from_x11()
and does the same work, but now its argument is a Window struct instead of a
WWindow.

This change is better because it allows objects with Windows (but without
WWindows) to call this function.

The function now is not static to allow its use in other parts of the code.

src/wmspec.c
src/wmspec.h

index 6bd51ce..b3dfb8b 100644 (file)
@@ -420,7 +420,7 @@ static RImage *makeRImageFromARGBData(unsigned long *data)
        return image;
 }
 
-static RImage *get_wwindow_image_from_x11(WWindow *wwin)
+RImage *get_window_image_from_x11(Window window)
 {
        RImage *image;
        Atom type;
@@ -429,7 +429,7 @@ static RImage *get_wwindow_image_from_x11(WWindow *wwin)
        unsigned long *property, *data;
 
        /* Get the icon from X11 Window */
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon, 0L, LONG_MAX,
+       if (XGetWindowProperty(dpy, window, net_wm_icon, 0L, LONG_MAX,
                               False, XA_CARDINAL, &type, &format, &items, &rest,
                               (unsigned char **)&property) != Success || !property)
                return NULL;
@@ -464,7 +464,7 @@ static void updateIconImage(WWindow *wwin)
                RReleaseImage(wwin->net_icon_image);
 
        /* Save the icon in the X11 icon */
-       wwin->net_icon_image = get_wwindow_image_from_x11(wwin);
+       wwin->net_icon_image = get_window_image_from_x11(wwin->client_win);
 
        /* Refresh the Window Icon */
        if (wwin->icon)
index 63d1eff..5bb26f0 100644 (file)
@@ -45,4 +45,5 @@ char *wNETWMGetIconName(Window window);
 char *wNETWMGetWindowName(Window window);
 void wNETFrameExtents(WWindow *wwin);
 void wNETCleanupFrameExtents(WWindow *wwin);
+RImage *get_window_image_from_x11(Window window);
 #endif