#include <stdlib.h>
#include <string.h>
-#include <X11/Intrinsic.h>
-#include <X11/Xatom.h>
-#include "motif.h"
+#if !X_DISPLAY_MISSING
+# include <X11/Intrinsic.h>
+# include <X11/Xatom.h>
+#endif
+#include "ewmhicon.h"
static unsigned long scale16to8(unsigned x)
{
}
}
+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);
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)
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