checking result of XGetClassHint, removed some obsolete lines in initfont()

This commit is contained in:
Anselm R Garbe 2008-08-29 10:13:47 +01:00
parent 73ec124ae9
commit 26f41c9055

8
dwm.c
View file

@ -233,7 +233,7 @@ static Client *sel = NULL;
static Client *stack = NULL; static Client *stack = NULL;
static Cursor cursor[CurLast]; static Cursor cursor[CurLast];
static Display *dpy; static Display *dpy;
static DC dc = {0}; static DC dc;
static Layout *lt[] = { NULL, NULL }; static Layout *lt[] = { NULL, NULL };
static Window root, barwin; static Window root, barwin;
/* configuration, allows nested code to access above variables */ /* configuration, allows nested code to access above variables */
@ -250,7 +250,8 @@ applyrules(Client *c) {
XClassHint ch = { 0 }; XClassHint ch = { 0 };
/* rule matching */ /* rule matching */
XGetClassHint(dpy, c->win, &ch); if(XGetClassHint(dpy, c->win, &ch) == 0)
return;
for(i = 0; i < LENGTH(rules); i++) { for(i = 0; i < LENGTH(rules); i++) {
r = &rules[i]; r = &rules[i];
if((!r->title || strstr(c->name, r->title)) if((!r->title || strstr(c->name, r->title))
@ -796,9 +797,6 @@ initfont(const char *fontstr) {
} }
} }
else { else {
if(dc.font.xfont)
XFreeFont(dpy, dc.font.xfont);
dc.font.xfont = NULL;
if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
&& !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
die("error, cannot load font: '%s'\n", fontstr); die("error, cannot load font: '%s'\n", fontstr);