JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
we don't need to set the font all the time
[dwm.git] / main.c
diff --git a/main.c b/main.c
index 73b713f..39958c1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -21,7 +21,6 @@ char stext[256];
 int screen, sx, sy, sw, sh, wax, way, waw, wah;
 unsigned int bh, ntags, numlockmask;
 Atom wmatom[WMLast], netatom[NetLast];
-Bool running = True;
 Bool *seltag;
 Bool selscreen = True;
 Client *clients = NULL;
@@ -36,6 +35,7 @@ Window root, barwin;
 
 static int (*xerrorxlib)(Display *, XErrorEvent *);
 static Bool otherwm, readin;
+static Bool running = True;
 
 static void
 cleanup(void) {
@@ -205,6 +205,8 @@ setup(void) {
        dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
        dc.gc = XCreateGC(dpy, root, 0, 0);
        XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
+       if(!dc.font.set)
+               XSetFont(dpy, dc.gc, dc.font.xfont->fid);
        /* multihead support */
        selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
 }
@@ -222,21 +224,7 @@ xerrorstart(Display *dsply, XErrorEvent *ee) {
 /* extern */
 
 void
-sendevent(Window w, Atom a, long value) {
-       XEvent e;
-
-       e.type = ClientMessage;
-       e.xclient.window = w;
-       e.xclient.message_type = a;
-       e.xclient.format = 32;
-       e.xclient.data.l[0] = value;
-       e.xclient.data.l[1] = CurrentTime;
-       XSendEvent(dpy, w, False, NoEventMask, &e);
-       XSync(dpy, False);
-}
-
-void
-quit(Arg *arg) {
+quit(const char *arg) {
        readin = running = False;
 }
 
@@ -325,12 +313,11 @@ main(int argc, char *argv[]) {
                        }
                        drawstatus();
                }
-               if(FD_ISSET(xfd, &rd))
-                       while(XPending(dpy)) {
-                               XNextEvent(dpy, &ev);
-                               if(handler[ev.type])
-                                       (handler[ev.type])(&ev); /* call handler */
-                       }
+               while(XPending(dpy)) {
+                       XNextEvent(dpy, &ev);
+                       if(handler[ev.type])
+                               (handler[ev.type])(&ev); /* call handler */
+               }
        }
        cleanup();
        XCloseDisplay(dpy);