equal
deleted
inserted
replaced
231 static Client *clients = NULL; |
231 static Client *clients = NULL; |
232 static Client *sel = NULL; |
232 static Client *sel = NULL; |
233 static Client *stack = NULL; |
233 static Client *stack = NULL; |
234 static Cursor cursor[CurLast]; |
234 static Cursor cursor[CurLast]; |
235 static Display *dpy; |
235 static Display *dpy; |
236 static DC dc = {0}; |
236 static DC dc; |
237 static Layout *lt[] = { NULL, NULL }; |
237 static Layout *lt[] = { NULL, NULL }; |
238 static Window root, barwin; |
238 static Window root, barwin; |
239 /* configuration, allows nested code to access above variables */ |
239 /* configuration, allows nested code to access above variables */ |
240 #include "config.h" |
240 #include "config.h" |
241 |
241 |
248 unsigned int i; |
248 unsigned int i; |
249 Rule *r; |
249 Rule *r; |
250 XClassHint ch = { 0 }; |
250 XClassHint ch = { 0 }; |
251 |
251 |
252 /* rule matching */ |
252 /* rule matching */ |
253 XGetClassHint(dpy, c->win, &ch); |
253 if(XGetClassHint(dpy, c->win, &ch) == 0) |
|
254 return; |
254 for(i = 0; i < LENGTH(rules); i++) { |
255 for(i = 0; i < LENGTH(rules); i++) { |
255 r = &rules[i]; |
256 r = &rules[i]; |
256 if((!r->title || strstr(c->name, r->title)) |
257 if((!r->title || strstr(c->name, r->title)) |
257 && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
258 && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
258 && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
259 && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
794 dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); |
795 dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); |
795 xfonts++; |
796 xfonts++; |
796 } |
797 } |
797 } |
798 } |
798 else { |
799 else { |
799 if(dc.font.xfont) |
|
800 XFreeFont(dpy, dc.font.xfont); |
|
801 dc.font.xfont = NULL; |
|
802 if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) |
800 if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) |
803 && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) |
801 && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) |
804 die("error, cannot load font: '%s'\n", fontstr); |
802 die("error, cannot load font: '%s'\n", fontstr); |
805 dc.font.ascent = dc.font.xfont->ascent; |
803 dc.font.ascent = dc.font.xfont->ascent; |
806 dc.font.descent = dc.font.xfont->descent; |
804 dc.font.descent = dc.font.xfont->descent; |