From ab3d6a7dfe76d9857f2fc621034359a2a0bf09df Mon Sep 17 00:00:00 2001 From: Anselm R. Garbe Date: Mon, 14 May 2007 11:54:30 +0200 Subject: applied dfenze cleanups, fixed some comments in dwm.h --- client.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 3db14f5..72e5c32 100644 --- a/client.c +++ b/client.c @@ -152,6 +152,14 @@ focus(Client *c) { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); } +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 @@ unmanage(Client *c) { 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); -- cgit v1.2.3