diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-07-09 22:32:05 +0300 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-07-20 18:52:17 +0300 |
| commit | e262bdba183015d9de68d3d8adac1fbb1855da98 (patch) | |
| tree | 13064308d934f74ac2bd50bddf06d1196bc19fc1 | |
| parent | 6f2376333e25ff9ba5c4a131b04cde39c6fc16b8 (diff) | |
remove xerrorlib function pointer
| -rw-r--r-- | monsterwm.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/monsterwm.c b/monsterwm.c index ec30b03..ab7837f 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -151,7 +151,6 @@ static int xerrorstart(Display *dis, XErrorEvent *ee); static Bool running = True; static int wh, ww, currdeskidx = 0; -static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0, win_unfocus, win_focus; static Display *dis; static Window root; @@ -767,16 +766,21 @@ void setup(void) { netatoms[NET_ACTIVE] = XInternAtom(dis, "_NET_ACTIVE_WINDOW", False); netatoms[NET_FULLSCREEN] = XInternAtom(dis, "_NET_WM_STATE_FULLSCREEN", False); - /* check if another window manager is running */ - xerrorxlib = XSetErrorHandler(xerrorstart); + /* propagate EWMH support */ + XChangeProperty(dis, root, netatoms[NET_SUPPORTED], XA_ATOM, 32, + PropModeReplace, (unsigned char *)netatoms, NET_COUNT); + + /* set the appropriate error handler + * try an action that will cause an error if another wm is active + * wait until events are processed to process the error from the above action + * if all is good set the generic error handler */ + XSetErrorHandler(xerrorstart); + /* set masks for reporting events handled by the wm */ XSelectInput(dis, DefaultRootWindow(dis), SubstructureRedirectMask|ButtonPressMask| SubstructureNotifyMask|PropertyChangeMask); XSync(dis, False); - XSetErrorHandler(xerror); XSync(dis, False); - XChangeProperty(dis, root, netatoms[NET_SUPPORTED], XA_ATOM, 32, - PropModeReplace, (unsigned char *)netatoms, NET_COUNT); grabkeys(); } @@ -883,8 +887,7 @@ int xerror(__attribute__((unused)) Display *dis, XErrorEvent *ee) { || (ee->error_code == BadDrawable && (ee->request_code == X_PolyFillRectangle || ee->request_code == X_CopyArea || ee->request_code == X_PolySegment || ee->request_code == X_PolyText8))) return 0; - warn("error: xerror: request code: %d, error code: %d", ee->request_code, ee->error_code); - return xerrorxlib(dis, ee); + err(EXIT_FAILURE, "xerror: request: %d code: %d", ee->request_code, ee->error_code); } /** |
