X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=d171fe2eff18d9038fe41c989cb606b0da89f9d4;hp=cbe2752851d7f981096c37ddcb46f00d75eb3da7;hb=b68528d85df68e681233609b38a137e3b6060775;hpb=c1f8688bfa56e388dac0e0a9abc90fdb0324b6db diff --git a/dwm.c b/dwm.c index cbe2752..d171fe2 100644 --- a/dwm.c +++ b/dwm.c @@ -267,7 +267,6 @@ static void (*handler[LASTEvent]) (XEvent *) = { [UnmapNotify] = unmapnotify }; static Atom wmatom[WMLast], netatom[NetLast]; -static Bool otherwm; static Bool running = True; static Cursor cursor[CurLast]; static Display *dpy; @@ -458,13 +457,10 @@ buttonpress(XEvent *e) { void checkotherwm(void) { - otherwm = False; xerrorxlib = XSetErrorHandler(xerrorstart); /* this causes an error if some other window manager is running */ XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); XSync(dpy, False); - if(otherwm) - die("dwm: another window manager is already running\n"); XSetErrorHandler(xerror); XSync(dpy, False); } @@ -994,12 +990,11 @@ initfont(const char *fontstr) { XFreeStringList(missing); } if(dc.font.set) { - XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; dc.font.ascent = dc.font.descent = 0; - font_extents = XExtentsOfFontSet(dc.font.set); + XExtentsOfFontSet(dc.font.set); n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); @@ -1088,14 +1083,12 @@ killclient(const Arg *arg) { void manage(Window w, XWindowAttributes *wa) { - static Client cz; Client *c, *t = NULL; Window trans = None; XWindowChanges wc; - if(!(c = malloc(sizeof(Client)))) + if(!(c = calloc(1, sizeof(Client)))) die("fatal: could not malloc() %u bytes\n", sizeof(Client)); - *c = cz; c->win = w; updatetitle(c); if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { @@ -1270,7 +1263,7 @@ propertynotify(XEvent *e) { default: break; case XA_WM_TRANSIENT_FOR: if(!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) && - (c->isfloating = (wintoclient(trans)))) + (c->isfloating = (wintoclient(trans)) != NULL)) arrange(c->mon); break; case XA_WM_NORMAL_HINTS: @@ -1579,7 +1572,6 @@ showhide(Client *c) { } } - void sigchld(int unused) { if(signal(SIGCHLD, sigchld) == SIG_ERR) @@ -2015,7 +2007,7 @@ xerrordummy(Display *dpy, XErrorEvent *ee) { * is already running. */ int xerrorstart(Display *dpy, XErrorEvent *ee) { - otherwm = True; + die("dwm: another window manager is already running\n"); return -1; }