X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/2e68f22118438fed885c8cc3ccb8be94437eb327..6ff346bed992971f508102b5f0b9cf34038a2c08:/client.c?ds=sidebyside diff --git a/client.c b/client.c index 49229a7..6524c06 100644 --- a/client.c +++ b/client.c @@ -414,14 +414,16 @@ togglemax(Arg *arg) void unmanage(Client *c) { + Client *nc; + XGrabServer(dpy); XSetErrorHandler(xerrordummy); detach(c); detachstack(c); if(sel == c) { - for(sel = stack; sel && !isvisible(sel); sel = sel->snext); - focus(sel); + for(nc = stack; nc && !isvisible(nc); nc = nc->snext); + focus(nc); } XUngrabButton(dpy, AnyButton, AnyModifier, c->win);