aewl

diff client.c @ 378:83576f5f0a90

added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 29 Aug 2006 09:23:44 +0200
parents b1159a638d0a
children b00cc483d13b
line diff
     1.1 --- a/client.c	Mon Aug 28 14:32:51 2006 +0200
     1.2 +++ b/client.c	Tue Aug 29 09:23:44 2006 +0200
     1.3 @@ -230,13 +230,7 @@
     1.4  			DefaultVisual(dpy, screen),
     1.5  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
     1.6  
     1.7 -	if(clients)
     1.8 -		clients->prev = c;
     1.9 -	c->next = clients;
    1.10 -	clients = c;
    1.11 -
    1.12  	grabbuttons(c, False);
    1.13 -
    1.14  	if((tc = getclient(trans))) /* inherit tags */
    1.15  		for(i = 0; i < ntags; i++)
    1.16  			c->tags[i] = tc->tags[i];
    1.17 @@ -246,6 +240,9 @@
    1.18  		c->isfloat = trans
    1.19  			|| (c->maxw && c->minw &&
    1.20  				c->maxw == c->minw && c->maxh == c->minh);
    1.21 +
    1.22 +	attach(c);
    1.23 +
    1.24  	settitle(c);
    1.25  	if(isvisible(c))
    1.26  		sel = c;
    1.27 @@ -407,12 +404,7 @@
    1.28  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
    1.29  	XDestroyWindow(dpy, c->twin);
    1.30  
    1.31 -	if(c->prev)
    1.32 -		c->prev->next = c->next;
    1.33 -	if(c->next)
    1.34 -		c->next->prev = c->prev;
    1.35 -	if(c == clients)
    1.36 -		clients = c->next;
    1.37 +	detach(c);
    1.38  	if(sel == c) {
    1.39  		if(trans && (tc = getclient(trans)) && isvisible(tc))
    1.40  			sel = tc;