diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-02-15 16:00:02 +0000 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-02-15 16:00:02 +0000 |
| commit | 6ab163c6955cf7830dfbf39b6c7ba16114054d94 (patch) | |
| tree | 9cf2d2586994370c818ad1513951d098a8743f15 /dwm.c | |
| parent | urgency hook handling needs also to invert the square if present (diff) | |
| download | dwm-6ab163c6955cf7830dfbf39b6c7ba16114054d94.tar.gz dwm-6ab163c6955cf7830dfbf39b6c7ba16114054d94.zip | |
some drawbar() polishing, and certain related fixes
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 54 |
1 files changed, 33 insertions, 21 deletions
| @@ -164,9 +164,9 @@ 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); |
| @@ -562,39 +562,46 @@ detachstack(Client *c) { | |||
| 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; |
| 594 | m->dc.w = m->sw - x; | ||
| 595 | } | ||
| 596 | drawtext(m, stext, m->dc.norm, False); | ||
| 591 | } | 597 | } |
| 592 | drawtext(m, stext, m->dc.norm, False); | 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); |
| @@ -679,8 +686,10 @@ enternotify(XEvent *e) { | |||
| 679 | Client *c; | 686 | Client *c; |
| 680 | XCrossingEvent *ev = &e->xcrossing; | 687 | XCrossingEvent *ev = &e->xcrossing; |
| 681 | 688 | ||
| 682 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior); | 689 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) { |
| 683 | //return; | 690 | if(!isxinerama || ev->window != monitors[selmonitor].root) |
| 691 | return; | ||
| 692 | } | ||
| 684 | if((c = getclient(ev->window))) | 693 | if((c = getclient(ev->window))) |
| 685 | focus(c); | 694 | focus(c); |
| 686 | else { | 695 | else { |
| @@ -747,6 +756,7 @@ focus(Client *c) { | |||
| 747 | } | 756 | } |
| 748 | else { | 757 | else { |
| 749 | XSetInputFocus(dpy, m->root, RevertToPointerRoot, CurrentTime); | 758 | XSetInputFocus(dpy, m->root, RevertToPointerRoot, CurrentTime); |
| 759 | drawbar(); | ||
| 750 | } | 760 | } |
| 751 | } | 761 | } |
| 752 | 762 | ||
| @@ -972,11 +982,11 @@ initfont(Monitor *m, const char *fontstr) { | |||
| 972 | } | 982 | } |
| 973 | 983 | ||
| 974 | Bool | 984 | Bool |
| 975 | isoccupied(Monitor *m, unsigned int t) { | 985 | isoccupied(unsigned int monitor, unsigned int t) { |
| 976 | Client *c; | 986 | Client *c; |
| 977 | 987 | ||
| 978 | for(c = clients; c; c = c->next) | 988 | for(c = clients; c; c = c->next) |
| 979 | if(c->tags[t] && c->monitor == selmonitor) | 989 | if(c->tags[t] && c->monitor == monitor) |
| 980 | return True; | 990 | return True; |
| 981 | return False; | 991 | return False; |
| 982 | } | 992 | } |
| @@ -997,7 +1007,7 @@ isprotodel(Client *c) { | |||
| 997 | } | 1007 | } |
| 998 | 1008 | ||
| 999 | Bool | 1009 | Bool |
| 1000 | isurgent(int monitor, unsigned int t) { | 1010 | isurgent(unsigned int monitor, unsigned int t) { |
| 1001 | Client *c; | 1011 | Client *c; |
| 1002 | 1012 | ||
| 1003 | for(c = clients; c; c = c->next) | 1013 | for(c = clients; c; c = c->next) |
| @@ -1010,8 +1020,10 @@ Bool | |||
| 1010 | isvisible(Client *c, int monitor) { | 1020 | isvisible(Client *c, int monitor) { |
| 1011 | unsigned int i; | 1021 | unsigned int i; |
| 1012 | 1022 | ||
| 1023 | if(c->monitor != monitor) | ||
| 1024 | return False; | ||
| 1013 | for(i = 0; i < LENGTH(tags); i++) | 1025 | for(i = 0; i < LENGTH(tags); i++) |
| 1014 | if(c->tags[i] && monitors[c->monitor].seltags[i] && c->monitor == monitor) | 1026 | if(c->tags[i] && monitors[c->monitor].seltags[i]) |
| 1015 | return True; | 1027 | return True; |
| 1016 | return False; | 1028 | return False; |
| 1017 | } | 1029 | } |
