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 wrap: on
line diff
--- a/client.c	Mon Aug 28 14:32:51 2006 +0200
+++ b/client.c	Tue Aug 29 09:23:44 2006 +0200
@@ -230,13 +230,7 @@
 			DefaultVisual(dpy, screen),
 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
 
-	if(clients)
-		clients->prev = c;
-	c->next = clients;
-	clients = c;
-
 	grabbuttons(c, False);
-
 	if((tc = getclient(trans))) /* inherit tags */
 		for(i = 0; i < ntags; i++)
 			c->tags[i] = tc->tags[i];
@@ -246,6 +240,9 @@
 		c->isfloat = trans
 			|| (c->maxw && c->minw &&
 				c->maxw == c->minw && c->maxh == c->minh);
+
+	attach(c);
+
 	settitle(c);
 	if(isvisible(c))
 		sel = c;
@@ -407,12 +404,7 @@
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
 	XDestroyWindow(dpy, c->twin);
 
-	if(c->prev)
-		c->prev->next = c->next;
-	if(c->next)
-		c->next->prev = c->prev;
-	if(c == clients)
-		clients = c->next;
+	detach(c);
 	if(sel == c) {
 		if(trans && (tc = getclient(trans)) && isvisible(tc))
 			sel = tc;