162 Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); |
162 Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); |
163 void grabbuttons(Client *c, Bool focused); |
163 void grabbuttons(Client *c, Bool focused); |
164 void grabkeys(void); |
164 void grabkeys(void); |
165 unsigned int idxoftag(const char *tag); |
165 unsigned int idxoftag(const char *tag); |
166 void initfont(Monitor*, const char *fontstr); |
166 void initfont(Monitor*, const char *fontstr); |
167 Bool isoccupied(Monitor *m, unsigned int t); |
167 Bool isoccupied(unsigned int monitor, unsigned int t); |
168 Bool isprotodel(Client *c); |
168 Bool isprotodel(Client *c); |
169 Bool isurgent(int monitor, unsigned int t); |
169 Bool isurgent(unsigned int monitor, unsigned int t); |
170 Bool isvisible(Client *c, int monitor); |
170 Bool isvisible(Client *c, int monitor); |
171 void keypress(XEvent *e); |
171 void keypress(XEvent *e); |
172 void killclient(const char *arg); |
172 void killclient(const char *arg); |
173 void manage(Window w, XWindowAttributes *wa); |
173 void manage(Window w, XWindowAttributes *wa); |
174 void mappingnotify(XEvent *e); |
174 void mappingnotify(XEvent *e); |
560 } |
560 } |
561 |
561 |
562 void |
562 void |
563 drawbar(void) { |
563 drawbar(void) { |
564 int i, j, x; |
564 int i, j, x; |
|
565 Client *c; |
565 |
566 |
566 for(i = 0; i < mcount; i++) { |
567 for(i = 0; i < mcount; i++) { |
567 Monitor *m = &monitors[i]; |
568 Monitor *m = &monitors[i]; |
568 m->dc.x = 0; |
569 m->dc.x = 0; |
|
570 for(c = stack; c && !isvisible(c, i); c = c->snext); |
|
571 fprintf(stderr, "m%d %s\n", i, c ? c->name : "NIL"); |
569 for(j = 0; j < LENGTH(tags); j++) { |
572 for(j = 0; j < LENGTH(tags); j++) { |
570 m->dc.w = textw(m, tags[j]); |
573 m->dc.w = textw(m, tags[j]); |
571 if(m->seltags[j]) { |
574 if(m->seltags[j]) { |
572 drawtext(m, tags[j], m->dc.sel, isurgent(i, j)); |
575 drawtext(m, tags[j], m->dc.sel, isurgent(i, j)); |
573 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor, |
576 drawsquare(m, c && c->tags[j] && c->monitor == i, |
574 isoccupied(m, j), isurgent(i, j), m->dc.sel); |
577 isoccupied(i, j), isurgent(i, j), m->dc.sel); |
575 } |
578 } |
576 else { |
579 else { |
577 drawtext(m, tags[j], m->dc.norm, isurgent(i, j)); |
580 drawtext(m, tags[j], m->dc.norm, isurgent(i, j)); |
578 drawsquare(m, sel && sel->tags[j] && sel->monitor == selmonitor, |
581 drawsquare(m, c && c->tags[j] && c->monitor == i, |
579 isoccupied(m, j), isurgent(i, j), m->dc.norm); |
582 isoccupied(i, j), isurgent(i, j), m->dc.norm); |
580 } |
583 } |
581 m->dc.x += m->dc.w; |
584 m->dc.x += m->dc.w; |
582 } |
585 } |
583 m->dc.w = blw; |
586 m->dc.w = blw; |
584 drawtext(m, m->layout->symbol, m->dc.norm, False); |
587 drawtext(m, m->layout->symbol, m->dc.norm, False); |
585 x = m->dc.x + m->dc.w; |
588 x = m->dc.x + m->dc.w; |
586 m->dc.w = textw(m, stext); |
589 if(i == selmonitor) { |
587 m->dc.x = m->sw - m->dc.w; |
590 m->dc.w = textw(m, stext); |
588 if(m->dc.x < x) { |
591 m->dc.x = m->sw - m->dc.w; |
589 m->dc.x = x; |
592 if(m->dc.x < x) { |
590 m->dc.w = m->sw - x; |
593 m->dc.x = x; |
591 } |
594 m->dc.w = m->sw - x; |
592 drawtext(m, stext, m->dc.norm, False); |
595 } |
|
596 drawtext(m, stext, m->dc.norm, False); |
|
597 } |
|
598 else |
|
599 m->dc.x = m->sw; |
593 if((m->dc.w = m->dc.x - x) > bh) { |
600 if((m->dc.w = m->dc.x - x) > bh) { |
594 m->dc.x = x; |
601 m->dc.x = x; |
595 if(sel && sel->monitor == selmonitor) { |
602 if(c) { |
596 drawtext(m, sel->name, m->dc.sel, False); |
603 drawtext(m, c->name, m->dc.sel, False); |
597 drawsquare(m, False, sel->isfloating, False, m->dc.sel); |
604 drawsquare(m, False, c->isfloating, False, m->dc.sel); |
598 } |
605 } |
599 else |
606 else |
600 drawtext(m, NULL, m->dc.norm, False); |
607 drawtext(m, NULL, m->dc.norm, False); |
601 } |
608 } |
602 XCopyArea(dpy, m->dc.drawable, m->barwin, m->dc.gc, 0, 0, m->sw, bh, 0, 0); |
609 XCopyArea(dpy, m->dc.drawable, m->barwin, m->dc.gc, 0, 0, m->sw, bh, 0, 0); |