[hackers] [dwm] fixed getclient brokeness || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Wed, 24 Jun 2009 11:48:06 +0000 (UTC)

changeset: 1414:68427ad40a9f
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Wed Jun 24 12:48:01 2009 +0100
files: dwm.c
description:
fixed getclient brokeness

diff -r e0b1ca478d40 -r 68427ad40a9f dwm.c
--- a/dwm.c Wed Jun 24 11:14:51 2009 +0100
+++ b/dwm.c Wed Jun 24 12:48:01 2009 +0100
@@ -829,12 +829,14 @@
 
 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 @@
 
         /* 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);
Received on Wed Jun 24 2009 - 11:48:06 UTC

This archive was generated by hypermail 2.2.0 : Wed Jun 24 2009 - 12:00:06 UTC