merged merge
815f9c05
1 file(s) · +16 −19
| 61 | 61 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
|
| 62 | 62 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
|
| 63 | 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 | 65 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
|
| 66 | 66 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
|
| 67 | 67 | ||
| 233 | 233 | static Client *stack = NULL; |
|
| 234 | 234 | static Cursor cursor[CurLast]; |
|
| 235 | 235 | static Display *dpy; |
|
| 236 | - | static DC dc = {0}; |
|
| 236 | + | static DC dc; |
|
| 237 | 237 | static Layout *lt[] = { NULL, NULL }; |
|
| 238 | 238 | static Window root, barwin; |
|
| 239 | 239 | /* configuration, allows nested code to access above variables */ |
|
| 250 | 250 | XClassHint ch = { 0 }; |
|
| 251 | 251 | ||
| 252 | 252 | /* rule matching */ |
|
| 253 | - | XGetClassHint(dpy, c->win, &ch); |
|
| 254 | - | for(i = 0; i < LENGTH(rules); i++) { |
|
| 255 | - | r = &rules[i]; |
|
| 256 | - | if((!r->title || strstr(c->name, r->title)) |
|
| 257 | - | && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
|
| 258 | - | && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
|
| 259 | - | c->isfloating = r->isfloating; |
|
| 260 | - | c->tags |= r->tags & TAGMASK; |
|
| 253 | + | if(XGetClassHint(dpy, c->win, &ch)) { |
|
| 254 | + | for(i = 0; i < LENGTH(rules); i++) { |
|
| 255 | + | r = &rules[i]; |
|
| 256 | + | if((!r->title || strstr(c->name, r->title)) |
|
| 257 | + | && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
|
| 258 | + | && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
|
| 259 | + | c->isfloating = r->isfloating; |
|
| 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 | 268 | if(!c->tags) |
|
| 268 | 269 | c->tags = tagset[seltags]; |
|
| 269 | 270 | } |
|
| 796 | 797 | } |
|
| 797 | 798 | } |
|
| 798 | 799 | else { |
|
| 799 | - | if(dc.font.xfont) |
|
| 800 | - | XFreeFont(dpy, dc.font.xfont); |
|
| 801 | - | dc.font.xfont = NULL; |
|
| 802 | 800 | if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) |
|
| 803 | 801 | && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) |
|
| 804 | 802 | die("error, cannot load font: '%s'\n", fontstr); |
|
| 1326 | 1324 | /* init atoms */ |
|
| 1327 | 1325 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
|
| 1328 | 1326 | wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
|
| 1329 | - | wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); |
|
| 1330 | 1327 | wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
|
| 1331 | 1328 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
|
| 1332 | 1329 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
|
| 1634 | 1631 | void |
|
| 1635 | 1632 | updatetitle(Client *c) { |
|
| 1636 | 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 | 1637 | void |
|