From: Dana Jansens Date: Fri, 15 Feb 2008 05:09:11 +0000 (-0500) Subject: register the _NET_WM_CM_S hint with the correct screen number X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=981dfd30f8151349fac1f046f841529922dbebe0;p=dana%2Fxcompmgr.git register the _NET_WM_CM_S hint with the correct screen number --- diff --git a/xcompmgr.c b/xcompmgr.c index 947a10d..baf68cf 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -155,6 +155,7 @@ Bool winTypeFade[NUM_WINTYPES]; /* opacity property name; sometime soon I'll write up an EWMH spec for it */ #define OPACITY_PROP "_NET_WM_WINDOW_OPACITY" +#define REGISTER_PROP "_NET_WM_CM_S" #define TRANSLUCENT 0xe0000000 #define OPAQUE 0xffffffff @@ -1910,10 +1911,14 @@ usage (char *program) } static void -register_cm (void) +register_cm (int scr) { Window w; Atom a; + char *buf; + int len, s; + + if (scr < 0) return; w = XCreateSimpleWindow (dpy, RootWindow (dpy, 0), 0, 0, 1, 1, 0, None, None); @@ -1921,8 +1926,17 @@ register_cm (void) Xutf8SetWMProperties (dpy, w, "xcompmgr", "xcompmgr", NULL, 0, NULL, NULL, NULL); - /* FIXME: Don't hard code the screen number */ - a = XInternAtom (dpy, "_NET_WM_CM_S0", False); + len = strlen(REGISTER_PROP) + 2; + s = scr; + while (s >= 10) { + ++len; + s /= 10; + } + buf = malloc(len); + snprintf(buf, len, REGISTER_PROP"%d", scr); + + a = XInternAtom (dpy, buf, False); + free(buf); XSetSelectionOwner (dpy, a, w, 0); } @@ -2072,7 +2086,7 @@ main (int argc, char **argv) exit (1); } - register_cm(); + register_cm(scr); /* get atoms */ opacityAtom = XInternAtom (dpy, OPACITY_PROP, False);