diff options
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 35 |
1 files changed, 16 insertions, 19 deletions
| @@ -61,7 +61,7 @@ | |||
| 61 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | 61 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
| 62 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ | 62 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
| 63 | enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ | 63 | enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
| 64 | enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ | 64 | enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ |
| 65 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | 65 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
| 66 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ | 66 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
| 67 | 67 | ||
| @@ -233,7 +233,7 @@ 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 */ |
| @@ -250,20 +250,21 @@ applyrules(Client *c) { | |||
| 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)) { |
| 254 | for(i = 0; i < LENGTH(rules); i++) { | 254 | for(i = 0; i < LENGTH(rules); i++) { |
| 255 | r = &rules[i]; | 255 | r = &rules[i]; |
| 256 | if((!r->title || strstr(c->name, r->title)) | 256 | if((!r->title || strstr(c->name, r->title)) |
| 257 | && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) | 257 | && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
| 258 | && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { | 258 | && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
| 259 | c->isfloating = r->isfloating; | 259 | c->isfloating = r->isfloating; |
| 260 | c->tags |= r->tags & TAGMASK; | 260 | c->tags |= r->tags & TAGMASK; |
| 261 | } | ||
| 261 | } | 262 | } |
| 263 | if(ch.res_class) | ||
| 264 | XFree(ch.res_class); | ||
| 265 | if(ch.res_name) | ||
| 266 | XFree(ch.res_name); | ||
| 262 | } | 267 | } |
| 263 | if(ch.res_class) | ||
| 264 | XFree(ch.res_class); | ||
| 265 | if(ch.res_name) | ||
| 266 | XFree(ch.res_name); | ||
| 267 | if(!c->tags) | 268 | if(!c->tags) |
| 268 | c->tags = tagset[seltags]; | 269 | c->tags = tagset[seltags]; |
| 269 | } | 270 | } |
| @@ -796,9 +797,6 @@ initfont(const char *fontstr) { | |||
| 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); |
| @@ -1326,7 +1324,6 @@ setup(void) { | |||
| 1326 | /* init atoms */ | 1324 | /* init atoms */ |
| 1327 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); | 1325 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
| 1328 | wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); | 1326 | wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
| 1329 | wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); | ||
| 1330 | wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); | 1327 | wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
| 1331 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); | 1328 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
| 1332 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | 1329 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
| @@ -1634,7 +1631,7 @@ updatesizehints(Client *c) { | |||
| 1634 | void | 1631 | void |
| 1635 | updatetitle(Client *c) { | 1632 | updatetitle(Client *c) { |
| 1636 | if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) | 1633 | if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) |
| 1637 | gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name); | 1634 | gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); |
| 1638 | } | 1635 | } |
| 1639 | 1636 | ||
| 1640 | void | 1637 | void |
