summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xcompmgr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xcompmgr.c b/xcompmgr.c
index 54aaa41..bf7910b 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -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);