From 4b3b597da3523078b5f30b3571c896bf2056fcb5 Mon Sep 17 00:00:00 2001 From: Premysl Hruby Date: Mon, 25 Aug 2008 11:43:45 +0200 Subject: WM_NAME is builtin atom --- dwm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dwm.c b/dwm.c index 89bca147..52a35407 100644 --- a/dwm.c +++ b/dwm.c @@ -60,7 +60,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ -enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ +enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -1326,7 +1326,6 @@ setup(void) { /* init atoms */ wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); - wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); @@ -1634,7 +1633,7 @@ updatesizehints(Client *c) { void updatetitle(Client *c) { if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) - gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name); + gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); } void -- cgit v1.2.3 From 26f41c905529c6df908980c731077fa340a9e1c8 Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Fri, 29 Aug 2008 10:13:47 +0100 Subject: checking result of XGetClassHint, removed some obsolete lines in initfont() --- dwm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dwm.c b/dwm.c index 7faad221..d7d8bff0 100644 --- a/dwm.c +++ b/dwm.c @@ -233,7 +233,7 @@ static Client *sel = NULL; static Client *stack = NULL; static Cursor cursor[CurLast]; static Display *dpy; -static DC dc = {0}; +static DC dc; static Layout *lt[] = { NULL, NULL }; static Window root, barwin; /* configuration, allows nested code to access above variables */ @@ -250,7 +250,8 @@ applyrules(Client *c) { XClassHint ch = { 0 }; /* rule matching */ - XGetClassHint(dpy, c->win, &ch); + 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)) @@ -796,9 +797,6 @@ initfont(const char *fontstr) { } } else { - if(dc.font.xfont) - XFreeFont(dpy, dc.font.xfont); - dc.font.xfont = NULL; if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) die("error, cannot load font: '%s'\n", fontstr); -- cgit v1.2.3 From addc52c9485f63a71f3afa54631f3b56b6bf2225 Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Fri, 29 Aug 2008 11:29:42 +0100 Subject: fixed --- dwm.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dwm.c b/dwm.c index d7d8bff0..2a4bacc5 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]; } -- cgit v1.2.3