aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dminiwm.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/dminiwm.c b/dminiwm.c
index 7a74adb..a2de270 100644
--- a/dminiwm.c
+++ b/dminiwm.c
@@ -94,7 +94,6 @@ static void destroynotify(XEvent *e);
static void enternotify(XEvent *e);
static void die(const char* errstr, ...);
static int xerrorstart(Display *dis, XErrorEvent *ee);
-static void checkotherwm(void);
static unsigned long getcolor(const char* color);
static void grabkeys(void);
static void keypress(XEvent *e);
@@ -782,7 +781,13 @@ void setup(void) {
atoms[_NET_WM_WINDOW_TYPE_SPLASH] = XInternAtom(dis, "_NET_WM_WINDOW_TYPE_SPLASH", False);
atoms[_NET_WM_WINDOW_TYPE_DIALOG] = XInternAtom(dis, "_NET_WM_WINDOW_TYPE_DIALOG", False);
atoms[_NET_WM_WINDOW_TYPE_NOTIFICATION] = XInternAtom(dis, "_NET_WM_WINDOW_TYPE_NOTIFICATION", False);
- XSelectInput(dis, root, SubstructureNotifyMask|SubstructureRedirectMask);
+
+ /* check if another window manager is running */
+ xerrorxlib = XSetErrorHandler(xerrorstart);
+ XSelectInput(dis, DefaultRootWindow(dis), SubstructureNotifyMask|SubstructureRedirectMask);
+ XSync(dis, False);
+ XSetErrorHandler(xerror);
+ XSync(dis, False);
grabkeys();
}
@@ -792,15 +797,6 @@ int xerrorstart(Display *dis, XErrorEvent *ee) {
return -1;
}
-void checkotherwm(void) {
- xerrorxlib = XSetErrorHandler(xerrorstart);
- /* this causes an error if some other window manager is running */
- XSelectInput(dis, DefaultRootWindow(dis), SubstructureRedirectMask);
- XSync(dis, False);
- XSetErrorHandler(xerror);
- XSync(dis, False);
-}
-
/* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
@@ -856,7 +852,6 @@ int main(int argc, char *argv[]) {
die("usage: dminiwm [-v]\n");
if(!(dis = XOpenDisplay(NULL)))
die("error: cannot open display\n");
- checkotherwm();
setup();
run();
cleanup();