aewl

changeset 436:b3659c3c5dab

sanders solution is convincing and elegant
author Anselm R. Garbe <arg@10kloc.org>
date Wed, 06 Sep 2006 11:54:16 +0200
parents 42388f634de0
children 433a5c662f73
files client.c view.c
diffstat 2 files changed, 11 insertions(+), 51 deletions(-) [+]
line diff
     1.1 --- a/client.c	Wed Sep 06 11:46:35 2006 +0200
     1.2 +++ b/client.c	Wed Sep 06 11:54:16 2006 +0200
     1.3 @@ -99,14 +99,6 @@
     1.4  		}
     1.5  	}
     1.6  	if(c) {
     1.7 -		if((c->isfloat || arrange == dofloat) && (c != clients)) {
     1.8 -			detach(c);
     1.9 -			if(clients) {
    1.10 -				clients->prev = c;
    1.11 -				c->next = clients;
    1.12 -			}
    1.13 -			clients = c;
    1.14 -		}
    1.15  		grabbuttons(c, True);
    1.16  		drawtitle(c);
    1.17  		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
     2.1 --- a/view.c	Wed Sep 06 11:46:35 2006 +0200
     2.2 +++ b/view.c	Wed Sep 06 11:54:16 2006 +0200
     2.3 @@ -215,52 +215,20 @@
     2.4  void
     2.5  restack()
     2.6  {
     2.7 -	static unsigned int nwins = 0;
     2.8 -	static Window *wins = NULL;
     2.9 -	unsigned int f, fi, m, mi, n;
    2.10  	Client *c;
    2.11  	XEvent ev;
    2.12 -
    2.13 -	for(f = 0, m = 0, c = clients; c; c = c->next)
    2.14 -		if(isvisible(c)) {
    2.15 -			if(c->isfloat || arrange == dofloat)
    2.16 -				f++;
    2.17 -			else
    2.18 -				m++;
    2.19 +	
    2.20 +	if(!sel)
    2.21 +		return;
    2.22 +	if(sel->isfloat || arrange == dofloat) {
    2.23 +		XRaiseWindow(dpy, sel->win);
    2.24 +		XRaiseWindow(dpy, sel->twin);
    2.25 +	}
    2.26 +	if(arrange != dofloat) 
    2.27 +		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
    2.28 +			XLowerWindow(dpy, c->twin);
    2.29 +			XLowerWindow(dpy, c->win);
    2.30  		}
    2.31 -	if(!(n = 2 * (f + m))) {
    2.32 -		drawstatus();
    2.33 -		return;
    2.34 -	}
    2.35 -	if(nwins < n) {
    2.36 -		nwins = n;
    2.37 -		wins = erealloc(wins, nwins * sizeof(Window));
    2.38 -	}
    2.39 -
    2.40 -	fi = 0;
    2.41 -	mi = 2 * f;
    2.42 -	if(sel) {
    2.43 -		if(sel->isfloat || arrange == dofloat) {
    2.44 -			wins[fi++] = sel->twin;
    2.45 -			wins[fi++] = sel->win;
    2.46 -		}
    2.47 -		else {
    2.48 -			wins[mi++] = sel->twin;
    2.49 -			wins[mi++] = sel->win;
    2.50 -		}
    2.51 -	}
    2.52 -	for(c = clients; c; c = c->next)
    2.53 -		if(isvisible(c) && c != sel) {
    2.54 -			if(c->isfloat || arrange == dofloat) {
    2.55 -				wins[fi++] = c->twin;
    2.56 -				wins[fi++] = c->win;
    2.57 -			}
    2.58 -			else {
    2.59 -				wins[mi++] = c->twin;
    2.60 -				wins[mi++] = c->win;
    2.61 -			}
    2.62 -		}
    2.63 -	XRestackWindows(dpy, wins, n);
    2.64  	drawall();
    2.65  	XSync(dpy, False);
    2.66  	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));