JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
introduced monitor symbols
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index abdaa6c..5c714db 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -635,11 +635,8 @@ drawbar(Monitor *m) {
 
        dc.x = 0;
        if(mons->next) { /* more than a single monitor */
-               char buf[2];
-               buf[0] = m->screen_number + '0';
-               buf[1] = '\0';
-               dc.w = TEXTW(buf);
-               drawtext(buf, selmon == m ? dc.sel : dc.norm, True);
+               dc.w = TEXTW(monsyms[m->screen_number]);
+               drawtext(monsyms[m->screen_number], selmon == m ? dc.sel : dc.norm, True);
                dc.x += dc.w;
        }
        m->btx = dc.x;
@@ -1195,7 +1192,7 @@ pointertomon(int x, int y) {
        for(m = mons; m; m = m->next)
                if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh))
                        return m;
-       return mons;
+       return selmon;
 }
 
 void
@@ -1758,7 +1755,7 @@ updategeom(void) {
 
        /* select focused monitor */
        cleanupmons();
-       mons = newmons;
+       selmon = mons = newmons;
        selmon = wintomon(root);
 }
 
@@ -1891,7 +1888,7 @@ wintomon(Window w) {
                        return m;
        if((c = wintoclient(w)))
                return c->mon;
-       return mons;
+       return selmon;
 }
 
 /* There's no way to check accesses to destroyed windows, thus those cases are