applied Hiltjo's cleanup patch
b68528d8
1 file(s) · +3 −11
| 267 | 267 | [UnmapNotify] = unmapnotify |
|
| 268 | 268 | }; |
|
| 269 | 269 | static Atom wmatom[WMLast], netatom[NetLast]; |
|
| 270 | - | static Bool otherwm; |
|
| 271 | 270 | static Bool running = True; |
|
| 272 | 271 | static Cursor cursor[CurLast]; |
|
| 273 | 272 | static Display *dpy; |
|
| 458 | 457 | ||
| 459 | 458 | void |
|
| 460 | 459 | checkotherwm(void) { |
|
| 461 | - | otherwm = False; |
|
| 462 | 460 | xerrorxlib = XSetErrorHandler(xerrorstart); |
|
| 463 | 461 | /* this causes an error if some other window manager is running */ |
|
| 464 | 462 | XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); |
|
| 465 | 463 | XSync(dpy, False); |
|
| 466 | - | if(otherwm) |
|
| 467 | - | die("dwm: another window manager is already running\n"); |
|
| 468 | 464 | XSetErrorHandler(xerror); |
|
| 469 | 465 | XSync(dpy, False); |
|
| 470 | 466 | } |
|
| 994 | 990 | XFreeStringList(missing); |
|
| 995 | 991 | } |
|
| 996 | 992 | if(dc.font.set) { |
|
| 997 | - | XFontSetExtents *font_extents; |
|
| 998 | 993 | XFontStruct **xfonts; |
|
| 999 | 994 | char **font_names; |
|
| 1000 | 995 | ||
| 1001 | 996 | dc.font.ascent = dc.font.descent = 0; |
|
| 1002 | - | font_extents = XExtentsOfFontSet(dc.font.set); |
|
| 997 | + | XExtentsOfFontSet(dc.font.set); |
|
| 1003 | 998 | n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
|
| 1004 | 999 | for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { |
|
| 1005 | 1000 | dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); |
|
| 1088 | 1083 | ||
| 1089 | 1084 | void |
|
| 1090 | 1085 | manage(Window w, XWindowAttributes *wa) { |
|
| 1091 | - | static Client cz; |
|
| 1092 | 1086 | Client *c, *t = NULL; |
|
| 1093 | 1087 | Window trans = None; |
|
| 1094 | 1088 | XWindowChanges wc; |
|
| 1095 | 1089 | ||
| 1096 | - | if(!(c = malloc(sizeof(Client)))) |
|
| 1090 | + | if(!(c = calloc(1, sizeof(Client)))) |
|
| 1097 | 1091 | die("fatal: could not malloc() %u bytes\n", sizeof(Client)); |
|
| 1098 | - | *c = cz; |
|
| 1099 | 1092 | c->win = w; |
|
| 1100 | 1093 | updatetitle(c); |
|
| 1101 | 1094 | if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { |
|
| 1579 | 1572 | } |
|
| 1580 | 1573 | } |
|
| 1581 | 1574 | ||
| 1582 | - | ||
| 1583 | 1575 | void |
|
| 1584 | 1576 | sigchld(int unused) { |
|
| 1585 | 1577 | if(signal(SIGCHLD, sigchld) == SIG_ERR) |
|
| 2015 | 2007 | * is already running. */ |
|
| 2016 | 2008 | int |
|
| 2017 | 2009 | xerrorstart(Display *dpy, XErrorEvent *ee) { |
|
| 2018 | - | otherwm = True; |
|
| 2010 | + | die("dwm: another window manager is already running\n"); |
|
| 2019 | 2011 | return -1; |
|
| 2020 | 2012 | } |
|
| 2021 | 2013 | ||