diff -r e42bdee29c92 -r 73cd10af065a client.c --- a/client.c Thu May 10 13:49:17 2007 +0200 +++ b/client.c Mon May 14 11:54:30 2007 +0200 @@ -153,6 +153,14 @@ } void +focustopvisible(void) { + Client *c; + + for(c = stack; c && !isvisible(c); c = c->snext); + focus(c); +} + +void killclient(const char *arg) { XEvent ev; @@ -391,10 +399,8 @@ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ detach(c); detachstack(c); - if(sel == c) { - for(nc = stack; nc && !isvisible(nc); nc = nc->snext); - focus(nc); - } + if(sel == c) + focustopvisible(); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setclientstate(c, WithdrawnState); free(c->tags);