diff options
author | Yann Droneaud <ydroneaud@mandriva.com> | 2009-03-24 12:02:03 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-04-14 10:24:38 -0400 |
commit | 3b6155eb533936f756d9e3e4c5802c188b7db35a (patch) | |
tree | 27f4a83c44b490624c8e5b2b2f5137f5465316a5 /xcompmgr.c | |
parent | 56b0b324ae0dbe5dda2bb89ef43427a6c19777bc (diff) |
Check for _NET_WM_CM_Sn before trying to install ourself as composite manager
Check for a selection owner of _NET_WM_CM_Sn is the first thing to do
before taking ownership on it, so clients watching for selection ownership
changes won't be disturbed.
Diffstat (limited to 'xcompmgr.c')
-rw-r--r-- | xcompmgr.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -1876,7 +1876,7 @@ usage (char *program) exit (1); } -static void +static Bool register_cm (void) { Window w; @@ -1886,6 +1886,12 @@ register_cm (void) snprintf (net_wm_cm, sizeof (net_wm_cm), "_NET_WM_CM_S%d", scr); a = XInternAtom (dpy, net_wm_cm, False); + if (XGetSelectionOwner (dpy, a) != None) + { + fprintf (stderr, "Another composite manager is already running\n"); + return False; + } + w = XCreateSimpleWindow (dpy, RootWindow (dpy, scr), 0, 0, 1, 1, 0, None, None); @@ -1893,6 +1899,8 @@ register_cm (void) NULL); XSetSelectionOwner (dpy, a, w, 0); + + return True; } int @@ -2016,7 +2024,10 @@ main (int argc, char **argv) exit (1); } - register_cm(); + if (!register_cm()) + { + exit (1); + } /* get atoms */ opacityAtom = XInternAtom (dpy, OPACITY_PROP, False); |