summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarbeam@gmail.com <unknown>2011-08-15 18:44:12 +0200
committergarbeam@gmail.com <unknown>2011-08-15 18:44:12 +0200
commit0f1f30daca0eaf0a400fd3f8d274594c07b32a51 (patch)
tree058d3077c6d1af74c08836947d137f144ae221f6
parentapplied Connors and Valentins patch to improve the unmapnotify handling of br... (diff)
downloaddwm-0f1f30daca0eaf0a400fd3f8d274594c07b32a51.tar.gz
dwm-0f1f30daca0eaf0a400fd3f8d274594c07b32a51.zip
applied Connors cleanup patch of Eckehards proposed fix of applyrules(), thanks everyone involved
-rw-r--r--dwm.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/dwm.c b/dwm.c
index 6909969..39b0a51 100644
--- a/dwm.c
+++ b/dwm.c
@@ -289,31 +289,31 @@ applyrules(Client *c) {
289 unsigned int i; 289 unsigned int i;
290 const Rule *r; 290 const Rule *r;
291 Monitor *m; 291 Monitor *m;
292 XClassHint ch = { 0 }; 292 XClassHint ch = { NULL, NULL };
293 293
294 /* rule matching */ 294 /* rule matching */
295 c->isfloating = c->tags = 0; 295 c->isfloating = c->tags = 0;
296 if(XGetClassHint(dpy, c->win, &ch)) { 296 XGetClassHint(dpy, c->win, &ch);
297 class = ch.res_class ? ch.res_class : broken; 297 class = ch.res_class ? ch.res_class : broken;
298 instance = ch.res_name ? ch.res_name : broken; 298 instance = ch.res_name ? ch.res_name : broken;
299 for(i = 0; i < LENGTH(rules); i++) { 299
300 r = &rules[i]; 300 for(i = 0; i < LENGTH(rules); i++) {
301 if((!r->title || strstr(c->name, r->title)) 301 r = &rules[i];
302 && (!r->class || strstr(class, r->class)) 302 if((!r->title || strstr(c->name, r->title))
303 && (!r->instance || strstr(instance, r->instance))) 303 && (!r->class || strstr(class, r->class))
304 { 304 && (!r->instance || strstr(instance, r->instance)))
305 c->isfloating = r->isfloating; 305 {
306 c->tags |= r->tags; 306 c->isfloating = r->isfloating;
307 for(m = mons; m && m->num != r->monitor; m = m->next); 307 c->tags |= r->tags;
308 if(m) 308 for(m = mons; m && m->num != r->monitor; m = m->next);
309 c->mon = m; 309 if(m)
310 } 310 c->mon = m;
311 } 311 }
312 if(ch.res_class)
313 XFree(ch.res_class);
314 if(ch.res_name)
315 XFree(ch.res_name);
316 } 312 }
313 if(ch.res_class)
314 XFree(ch.res_class);
315 if(ch.res_name)
316 XFree(ch.res_name);
317 c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; 317 c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
318} 318}
319 319