applied Connors cleanup patch of Eckehards proposed fix of applyrules(), thanks everyone involved

master
garbeam@gmail.com 2011-08-15 18:44:12 +02:00
parent dec4850d05
commit 0f1f30daca
1 changed files with 20 additions and 20 deletions

40
dwm.c
View File

@ -289,31 +289,31 @@ applyrules(Client *c) {
unsigned int i; unsigned int i;
const Rule *r; const Rule *r;
Monitor *m; Monitor *m;
XClassHint ch = { 0 }; XClassHint ch = { NULL, NULL };
/* rule matching */ /* rule matching */
c->isfloating = c->tags = 0; c->isfloating = c->tags = 0;
if(XGetClassHint(dpy, c->win, &ch)) { XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken; class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken; instance = ch.res_name ? ch.res_name : broken;
for(i = 0; i < LENGTH(rules); i++) {
r = &rules[i]; for(i = 0; i < LENGTH(rules); i++) {
if((!r->title || strstr(c->name, r->title)) r = &rules[i];
&& (!r->class || strstr(class, r->class)) if((!r->title || strstr(c->name, r->title))
&& (!r->instance || strstr(instance, r->instance))) && (!r->class || strstr(class, r->class))
{ && (!r->instance || strstr(instance, r->instance)))
c->isfloating = r->isfloating; {
c->tags |= r->tags; c->isfloating = r->isfloating;
for(m = mons; m && m->num != r->monitor; m = m->next); c->tags |= r->tags;
if(m) for(m = mons; m && m->num != r->monitor; m = m->next);
c->mon = m; if(m)
} c->mon = m;
} }
if(ch.res_class)
XFree(ch.res_class);
if(ch.res_name)
XFree(ch.res_name);
} }
if(ch.res_class)
XFree(ch.res_class);
if(ch.res_name)
XFree(ch.res_name);
c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
} }