X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dwm.c;h=12871cd8568bbeeb284c49a2d9ce67a5e7170884;hb=d15d4ba45abe06f5ac069e384bd7b46b55c0d286;hp=d7d8bff095b08da6cee25183ab9c5520c13c0028;hpb=26f41c905529c6df908980c731077fa340a9e1c8;p=dwm.git diff --git a/dwm.c b/dwm.c index d7d8bff..12871cd 100644 --- a/dwm.c +++ b/dwm.c @@ -250,21 +250,21 @@ applyrules(Client *c) { XClassHint ch = { 0 }; /* rule matching */ - if(XGetClassHint(dpy, c->win, &ch) == 0) - return; - for(i = 0; i < LENGTH(rules); i++) { - r = &rules[i]; - if((!r->title || strstr(c->name, r->title)) - && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) - && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { - c->isfloating = r->isfloating; - c->tags |= r->tags & TAGMASK; + if(XGetClassHint(dpy, c->win, &ch)) { + for(i = 0; i < LENGTH(rules); i++) { + r = &rules[i]; + if((!r->title || strstr(c->name, r->title)) + && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) + && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { + c->isfloating = r->isfloating; + c->tags |= r->tags & TAGMASK; + } } + 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); if(!c->tags) c->tags = tagset[seltags]; } @@ -331,7 +331,7 @@ buttonpress(XEvent *e) { for(i = 0; i < LENGTH(buttons); i++) if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) - buttons[i].func(click == ClkTagBar ? &arg : &buttons[i].arg); + buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); } void