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