X-Git-Url: http://git.draconx.ca/gitweb/rrace.git/blobdiff_plain/43a709ff25b9973a83327a06a6ecc94b09e7787b..a13b072946d80c2da325e90cb73d96a25485a80a:/src/ewmhicon.c diff --git a/src/ewmhicon.c b/src/ewmhicon.c index e071cec..32392a8 100644 --- a/src/ewmhicon.c +++ b/src/ewmhicon.c @@ -21,9 +21,11 @@ #include #include -#include -#include -#include "motif.h" +#if !X_DISPLAY_MISSING +# include +# include +#endif +#include "ewmhicon.h" static unsigned long scale16to8(unsigned x) { @@ -143,6 +145,39 @@ void ewmh_tile48(unsigned long *icon, const XColor *c, int tile_x, int tile_y) } } +void *ewmh_icon_alloc(unsigned long **sizes) +{ + unsigned long *buf; + + buf = calloc(sizeof *buf, EWMH_ICON_NELEM); + if (buf) { + sizes[ICON_16x16] = buf; + *sizes[ICON_16x16]++ = 16; + *sizes[ICON_16x16]++ = 16; + + sizes[ICON_24x24] = sizes[ICON_16x16] + 16*16; + *sizes[ICON_24x24]++ = 24; + *sizes[ICON_24x24]++ = 24; + + sizes[ICON_32x32] = sizes[ICON_24x24] + 24*24; + *sizes[ICON_32x32]++ = 32; + *sizes[ICON_32x32]++ = 32; + + sizes[ICON_48x48] = sizes[ICON_32x32] + 32*32; + *sizes[ICON_48x48]++ = 48; + *sizes[ICON_48x48]++ = 48; + } + + return buf; +} + +#if !X_DISPLAY_MISSING + +/* + * EWMH-supporting window managers that handle _NET_WM_ICON add this atom to + * the _NET_SUPPORTED list on the root window. Look for that and return 1 + * if it is found, or 0 otherwise. + */ int ewmh_probe_wm_icon(Widget shell) { Display *display = XtDisplay(shell); @@ -154,12 +189,12 @@ int ewmh_probe_wm_icon(Widget shell) unsigned char *prop_return; int format; - net_wm_icon = XInternAtom(display, "_NET_WM_ICON", FALSE); - net_supported = XInternAtom(display, "_NET_SUPPORTED", FALSE); + net_wm_icon = XInternAtom(display, "_NET_WM_ICON", 0); + net_supported = XInternAtom(display, "_NET_SUPPORTED", 0); do { XGetWindowProperty(display, root, net_supported, offset, 10, - FALSE, XA_ATOM, &type, - &format, &nitems, &bytes_after, + 0, XA_ATOM, &type, &format, + &nitems, &bytes_after, &prop_return); if (format != 32 || type != XA_ATOM) @@ -177,28 +212,4 @@ int ewmh_probe_wm_icon(Widget shell) return 0; } -void *ewmh_icon_alloc(unsigned long **sizes) -{ - unsigned long *buf; - - buf = calloc(sizeof *buf, EWMH_ICON_NELEM); - if (buf) { - sizes[ICON_16x16] = buf; - *sizes[ICON_16x16]++ = 16; - *sizes[ICON_16x16]++ = 16; - - sizes[ICON_24x24] = sizes[ICON_16x16] + 16*16; - *sizes[ICON_24x24]++ = 24; - *sizes[ICON_24x24]++ = 24; - - sizes[ICON_32x32] = sizes[ICON_24x24] + 24*24; - *sizes[ICON_32x32]++ = 32; - *sizes[ICON_32x32]++ = 32; - - sizes[ICON_48x48] = sizes[ICON_32x32] + 32*32; - *sizes[ICON_48x48]++ = 48; - *sizes[ICON_48x48]++ = 48; - } - - return buf; -} +#endif