aewl

diff client.c @ 712:b288b57d81f8

this version should also work with cornercases (like unmanage during !issel, etc.)
author Anselm R. Garbe <arg@suckless.org>
date Tue, 23 Jan 2007 12:00:49 +0100
parents b40134b93de3
children ef2c267884f3
line diff
     1.1 --- a/client.c	Tue Jan 23 11:49:16 2007 +0100
     1.2 +++ b/client.c	Tue Jan 23 12:00:49 2007 +0100
     1.3 @@ -79,15 +79,16 @@
     1.4  
     1.5  void
     1.6  focus(Client *c) {
     1.7 -	Client *old = sel;
     1.8 -
     1.9  	if(c && !isvisible(c))
    1.10  		return;
    1.11  
    1.12 -	if(old && old != c) {
    1.13 -		grabbuttons(old, False);
    1.14 -		XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
    1.15 +	if(sel && sel != c) {
    1.16 +		grabbuttons(sel, False);
    1.17 +		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
    1.18  	}
    1.19 +	sel = c;
    1.20 +	if(!issel)
    1.21 +		return;
    1.22  	if(c) {
    1.23  		detachstack(c);
    1.24  		c->snext = stack;
    1.25 @@ -96,9 +97,8 @@
    1.26  		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
    1.27  		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
    1.28  	}
    1.29 -	else if(issel)
    1.30 +	else
    1.31  		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
    1.32 -	sel = c;
    1.33  	drawstatus();
    1.34  }
    1.35