X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=main.c;h=50fb9d72dcf631e9c8c2c4394b16a95ecd3f008f;hb=56130c36894edd0c730e5c8ee0ac07cad524d176;hp=d0048be0ec5083964fef56a9e1071422b9e39cc7;hpb=df74b26e5dfa3ae0f3f66107a562be6ac46ee0c3;p=dwm.git diff --git a/main.c b/main.c index d0048be..50fb9d7 100644 --- a/main.c +++ b/main.c @@ -18,16 +18,24 @@ /* static */ static int (*xerrorxlib)(Display *, XErrorEvent *); -static Bool otherwm; +static Bool otherwm, readin; static void cleanup() { + close(STDIN_FILENO); while(sel) { resize(sel, True, TopLeft); unmanage(sel); } + if(dc.font.set) + XFreeFontSet(dpy, dc.font.set); + else + XFreeFont(dpy, dc.font.xfont); XUngrabKey(dpy, AnyKey, AnyModifier, root); + XDestroyWindow(dpy, barwin); + XFreePixmap(dpy, dc.drawable); + XFreeGC(dpy, dc.gc); XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, False); } @@ -139,7 +147,7 @@ sendevent(Window w, Atom a, long value) void quit(Arg *arg) { - running = False; + readin = running = False; } /* @@ -169,7 +177,6 @@ main(int argc, char *argv[]) int i, j, xfd; unsigned int mask; fd_set rd; - Bool readin = True; Window w; XModifierKeymap *modmap; XSetWindowAttributes wa; @@ -272,6 +279,7 @@ main(int argc, char *argv[]) /* main event loop, also reads status text from stdin */ XSync(dpy, False); procevent(); + readin = True; while(running) { FD_ZERO(&rd); if(readin)