about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2009-06-24 12:48:01 +0100
committerAnselm R Garbe <garbeam@gmail.com>2009-06-24 12:48:01 +0100
commit891831fe623d4062bf6ffbd9016721cc551cf511 (patch)
treec2d319e2a4333e8bfdbcb226030b1f86973b983b /dwm.c
parentcdb8e274531e5e82818d90e2cc4e3b46e7fe8eb6 (diff)
downloaddwm-891831fe623d4062bf6ffbd9016721cc551cf511.tar.gz
fixed getclient brokeness
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/dwm.c b/dwm.c
index 4c001fa..dd6701b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -829,12 +829,14 @@ focusstack(const Arg *arg) {
 
 Client *
 getclient(Window w) {
-	Client *c = NULL;
+	Client *c;
 	Monitor *m;
 
 	for(m = mons; m; m = m->next)
-		for(c = m->clients; c && c->win != w; c = c->next);
-	return c;
+		for(c = m->clients; c; c = c->next)
+			if(c->win == w)
+				return c;
+	return NULL;
 }
 
 unsigned long
@@ -1726,8 +1728,9 @@ updategeom(void) {
 
 	/* reassign left over clients of disappeared monitors */
 	for(tm = mons; tm; tm = tm->next) {
-		while((c = tm->clients)) {
-			detach(c);
+		while(tm->clients) {
+			c = tm->clients;
+			tm->clients = c->next;
 			detachstack(c);
 			c->mon = newmons;
 			attach(c);