143 void configurerequest(XEvent *e); |
143 void configurerequest(XEvent *e); |
144 void destroynotify(XEvent *e); |
144 void destroynotify(XEvent *e); |
145 void detach(Client *c); |
145 void detach(Client *c); |
146 void detachstack(Client *c); |
146 void detachstack(Client *c); |
147 void drawbar(void); |
147 void drawbar(void); |
148 void drawsquare(Monitor *, Bool filled, Bool empty, unsigned long col[ColLast]); |
148 void drawsquare(Monitor *, Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
149 void drawtext(Monitor *, const char *text, unsigned long col[ColLast], Bool invert); |
149 void drawtext(Monitor *, const char *text, unsigned long col[ColLast], Bool invert); |
150 void *emallocz(unsigned int size); |
150 void *emallocz(unsigned int size); |
151 void enternotify(XEvent *e); |
151 void enternotify(XEvent *e); |
152 void eprint(const char *errstr, ...); |
152 void eprint(const char *errstr, ...); |
153 void expose(XEvent *e); |
153 void expose(XEvent *e); |
568 m->dc.x = 0; |
568 m->dc.x = 0; |
569 for(j = 0; j < LENGTH(tags); j++) { |
569 for(j = 0; j < LENGTH(tags); j++) { |
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 } |
581 m->dc.w = blw; |
583 m->dc.w = blw; |
582 drawtext(m, m->layout->symbol, m->dc.norm, False); |
584 drawtext(m, m->layout->symbol, m->dc.norm, False); |
590 drawtext(m, stext, m->dc.norm, False); |
592 drawtext(m, stext, m->dc.norm, False); |
591 if((m->dc.w = m->dc.x - x) > bh) { |
593 if((m->dc.w = m->dc.x - x) > bh) { |
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); |
599 } |
601 } |
600 XCopyArea(dpy, m->dc.drawable, m->barwin, m->dc.gc, 0, 0, m->sw, bh, 0, 0); |
602 XCopyArea(dpy, m->dc.drawable, m->barwin, m->dc.gc, 0, 0, m->sw, bh, 0, 0); |
601 XSync(dpy, False); |
603 XSync(dpy, False); |
602 } |
604 } |
603 } |
605 } |
604 |
606 |
605 void |
607 void |
606 drawsquare(Monitor *m, Bool filled, Bool empty, unsigned long col[ColLast]) { |
608 drawsquare(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; |
615 r.y = m->dc.y + 1; |
617 r.y = m->dc.y + 1; |
616 if(filled) { |
618 if(filled) { |
1139 Window win; |
1141 Window win; |
1140 unsigned int mask; |
1142 unsigned int mask; |
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 |
1155 void |
1154 void |
1156 movemouse(Client *c) { |
1155 movemouse(Client *c) { |