dwm-meillo

changeset 709:6c2fcf88dd9f

this variant is known to work, but focus() is ugly - we need in general a better way to handle multihead, this issel-stuff looks awkward (maybe it might be a good idea to set sel to NULL but to introduce a Client *revert which is set if a screen is unfocused, have to think about it further).
author Anselm R. Garbe <arg@suckless.org>
date Mon, 22 Jan 2007 10:35:58 +0100
parents a2d568a5cdb8
children a25294eac73a
files client.c event.c
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/client.c	Mon Jan 22 10:22:58 2007 +0100
     1.2 +++ b/client.c	Mon Jan 22 10:35:58 2007 +0100
     1.3 @@ -81,7 +81,7 @@
     1.4  focus(Client *c) {
     1.5  	Client *old = sel;
     1.6  
     1.7 -	if(!issel || (c && !isvisible(c)))
     1.8 +	if(c && !isvisible(c))
     1.9  		return;
    1.10  
    1.11  	if(old && old != c) {
    1.12 @@ -89,14 +89,18 @@
    1.13  		XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
    1.14  	}
    1.15  	if(c) {
    1.16 -		detachstack(c);
    1.17 -		c->snext = stack;
    1.18 -		stack = c;
    1.19 -		grabbuttons(c, True);
    1.20 -		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
    1.21 -		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
    1.22 +		if(issel) {
    1.23 +			detachstack(c);
    1.24 +			c->snext = stack;
    1.25 +			stack = c;
    1.26 +			grabbuttons(c, True);
    1.27 +			XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
    1.28 +			XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
    1.29 +		}
    1.30 +		else
    1.31 +			XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
    1.32  	}
    1.33 -	else
    1.34 +	else if(issel)
    1.35  		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
    1.36  	sel = c;
    1.37  	drawstatus();
     2.1 --- a/event.c	Mon Jan 22 10:22:58 2007 +0100
     2.2 +++ b/event.c	Mon Jan 22 10:35:58 2007 +0100
     2.3 @@ -269,8 +269,8 @@
     2.4  	XCrossingEvent *ev = &e->xcrossing;
     2.5  
     2.6  	if((ev->window == root) && !ev->same_screen) {
     2.7 -		focus(NULL);
     2.8  		issel = False;
     2.9 +		focus(sel);
    2.10  	}
    2.11  }
    2.12