about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
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);
='#n19'>19 20 21 22 23 24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148