summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwm.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 79a3a33..f992ea9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -145,7 +145,7 @@ void destroynotify(XEvent *e);
145void detach(Client *c); 145void detach(Client *c);
146void detachstack(Client *c); 146void detachstack(Client *c);
147void drawbar(void); 147void drawbar(void);
148void drawsquare(Monitor *, Bool filled, Bool empty, unsigned long col[ColLast]); 148void drawsquare(Monitor *, Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
149void drawtext(Monitor *, const char *text, unsigned long col[ColLast], Bool invert); 149void drawtext(Monitor *, const char *text, unsigned long col[ColLast], Bool invert);
150void *emallocz(unsigned int size); 150void *emallocz(unsigned int size);
151void enternotify(XEvent *e); 151void enternotify(XEvent *e);
@@ -570,11 +570,13 @@ drawbar(void) {
570 m->dc.w = textw(m, tags[j]); 570 m->dc.w = textw(m, tags[j]);
571 if(m->seltags[j]) { 571 if(m->seltags[j]) {
572 drawtext(m, tags[j], m->dc.sel, isurgent(i, j)); 572 drawtext(m, tags[j], m->dc.sel, isurgent(i, j));
573 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor, isoccupied(m, j), m->dc.sel); 573 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor,
574 isoccupied(m, j), isurgent(i, j), m->dc.sel);
574 } 575 }
575 else { 576 else {
576 drawtext(m, tags[j], m->dc.norm, isurgent(i, j)); 577 drawtext(m, tags[j], m->dc.norm, isurgent(i, j));
577 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor, isoccupied(m, j), m->dc.norm); 578 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor,
579 isoccupied(m, j), isurgent(i, j), m->dc.norm);
578 } 580 }
579 m->dc.x += m->dc.w; 581 m->dc.x += m->dc.w;
580 } 582 }
@@ -592,7 +594,7 @@ drawbar(void) {
592 m->dc.x = x; 594 m->dc.x = x;
593 if(sel && sel->monitor == selmonitor) { 595 if(sel && sel->monitor == selmonitor) {
594 drawtext(m, sel->name, m->dc.sel, False); 596 drawtext(m, sel->name, m->dc.sel, False);
595 drawsquare(m, False, sel->isfloating, m->dc.sel); 597 drawsquare(m, False, sel->isfloating, False, m->dc.sel);
596 } 598 }
597 else 599 else
598 drawtext(m, NULL, m->dc.norm, False); 600 drawtext(m, NULL, m->dc.norm, False);
@@ -603,12 +605,12 @@ drawbar(void) {
603} 605}
604 606
605void 607void
606drawsquare(Monitor *m, Bool filled, Bool empty, unsigned long col[ColLast]) { 608drawsquare(Monitor *m, Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
607 int x; 609 int x;
608 XGCValues gcv; 610 XGCValues gcv;
609 XRectangle r = { m->dc.x, m->dc.y, m->dc.w, m->dc.h }; 611 XRectangle r = { m->dc.x, m->dc.y, m->dc.w, m->dc.h };
610 612
611 gcv.foreground = col[ColFG]; 613 gcv.foreground = col[invert ? ColBG : ColFG];
612 XChangeGC(dpy, m->dc.gc, GCForeground, &gcv); 614 XChangeGC(dpy, m->dc.gc, GCForeground, &gcv);
613 x = (m->dc.font.ascent + m->dc.font.descent + 2) / 4; 615 x = (m->dc.font.ascent + m->dc.font.descent + 2) / 4;
614 r.x = m->dc.x + 1; 616 r.x = m->dc.x + 1;
@@ -1141,14 +1143,11 @@ monitorat() {
1141 1143
1142 XQueryPointer(dpy, monitors[selmonitor].root, &win, &win, &x, &y, &i, &i, &mask); 1144 XQueryPointer(dpy, monitors[selmonitor].root, &win, &win, &x, &y, &i, &i, &mask);
1143 for(i = 0; i < mcount; i++) { 1145 for(i = 0; i < mcount; i++) {
1144 fprintf(stderr, "checking monitor[%d]: %d %d %d %d\n", i, monitors[i].sx, monitors[i].sy, monitors[i].sw, monitors[i].sh);
1145 if((x >= monitors[i].sx && x < monitors[i].sx + monitors[i].sw) 1146 if((x >= monitors[i].sx && x < monitors[i].sx + monitors[i].sw)
1146 && (y >= monitors[i].sy && y < monitors[i].sy + monitors[i].sh)) { 1147 && (y >= monitors[i].sy && y < monitors[i].sy + monitors[i].sh)) {
1147 fprintf(stderr, "%d,%d -> %d\n", x, y, i);
1148 return i; 1148 return i;
1149 } 1149 }
1150 } 1150 }
1151 fprintf(stderr, "?,? -> 0\n");
1152 return 0; 1151 return 0;
1153} 1152}
1154 1153