diff options
author | Enno Boland (tox) <tox@s01.de> | 2009-09-08 07:34:15 +0200 |
---|---|---|
committer | Enno Boland (tox) <tox@s01.de> | 2009-09-08 07:34:15 +0200 |
commit | 9bd43db63a9bf890cb6ed170796c0dc7002aae8e (patch) | |
tree | 33abb41d9f9bcec0e0667423f747f78580044a8a | |
parent | b8139e44db0fcd6f1858e1eec00daeec93838de5 (diff) |
reparenting works.
-rw-r--r-- | tabbed.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -83,6 +83,7 @@ static void run(void); static void setup(void); static int textnw(const char *text, unsigned int len); static void updatenumlockmask(void); +static int xerror(Display *dpy, XErrorEvent *ee); /* variables */ static int screen; @@ -261,8 +262,9 @@ spawntab(const Arg *arg) { } void -reparent(Window win) { - puts("reparent window"); +reparent(Window w) { + XSync(dpy, False); + XReparentWindow(dpy, w, win, 0, 0); } void @@ -361,6 +363,7 @@ setup(void) { ButtonPressMask|ExposureMask|KeyPressMask| LeaveWindowMask); XMapRaised(dpy, win); + XSetErrorHandler(xerror); } int @@ -394,6 +397,18 @@ updatenumlockmask(void) { XFreeModifiermap(modmap); } +/* 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. */ +int +xerror(Display *dpy, XErrorEvent *ee) { + if(ee->error_code == BadWindow) + return 0; + die("dwm: fatal error: request code=%d, error code=%d\n", + ee->request_code, ee->error_code); + return 1; +} + int main(int argc, char *argv[]) { if(argc == 2 && !strcmp("-v", argv[1])) |