equal
deleted
inserted
replaced
143 unsigned int idxoftag(const char *t); |
143 unsigned int idxoftag(const char *t); |
144 void initfont(const char *fontstr); |
144 void initfont(const char *fontstr); |
145 Bool isoccupied(unsigned int t); |
145 Bool isoccupied(unsigned int t); |
146 Bool isprotodel(Client *c); |
146 Bool isprotodel(Client *c); |
147 Bool isurgent(unsigned int t); |
147 Bool isurgent(unsigned int t); |
148 Bool isvisible(Client *c, Bool *cmp); |
148 Bool isvisible(Client *c); |
149 void keypress(XEvent *e); |
149 void keypress(XEvent *e); |
150 void killclient(const char *arg); |
150 void killclient(const char *arg); |
151 void manage(Window w, XWindowAttributes *wa); |
151 void manage(Window w, XWindowAttributes *wa); |
152 void mappingnotify(XEvent *e); |
152 void mappingnotify(XEvent *e); |
153 void maprequest(XEvent *e); |
153 void maprequest(XEvent *e); |
259 void |
259 void |
260 arrange(void) { |
260 arrange(void) { |
261 Client *c; |
261 Client *c; |
262 |
262 |
263 for(c = clients; c; c = c->next) |
263 for(c = clients; c; c = c->next) |
264 if(isvisible(c, NULL)) { |
264 if(isvisible(c)) { |
265 unban(c); |
265 unban(c); |
266 if(!lt->arrange || c->isfloating) |
266 if(!lt->arrange || c->isfloating) |
267 resize(c, c->x, c->y, c->w, c->h, True); |
267 resize(c, c->x, c->y, c->w, c->h, True); |
268 } |
268 } |
269 else |
269 else |
439 if((c->y - sy + c->h) > sh && c->isfloating) |
439 if((c->y - sy + c->h) > sh && c->isfloating) |
440 c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */ |
440 c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */ |
441 if((ev->value_mask & (CWX|CWY)) |
441 if((ev->value_mask & (CWX|CWY)) |
442 && !(ev->value_mask & (CWWidth|CWHeight))) |
442 && !(ev->value_mask & (CWWidth|CWHeight))) |
443 configure(c); |
443 configure(c); |
444 if(isvisible(c, NULL)) |
444 if(isvisible(c)) |
445 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
445 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
446 } |
446 } |
447 else |
447 else |
448 configure(c); |
448 configure(c); |
449 } |
449 } |
492 drawbar(void) { |
492 drawbar(void) { |
493 int i, x; |
493 int i, x; |
494 Client *c; |
494 Client *c; |
495 |
495 |
496 dc.x = 0; |
496 dc.x = 0; |
497 for(c = stack; c && !isvisible(c, NULL); c = c->snext); |
497 for(c = stack; c && !isvisible(c); c = c->snext); |
498 for(i = 0; i < LENGTH(tags); i++) { |
498 for(i = 0; i < LENGTH(tags); i++) { |
499 dc.w = textw(tags[i]); |
499 dc.w = textw(tags[i]); |
500 if(tagset[seltags][i]) { |
500 if(tagset[seltags][i]) { |
501 drawtext(tags[i], dc.sel, isurgent(i)); |
501 drawtext(tags[i], dc.sel, isurgent(i)); |
502 drawsquare(c && c->tags[i], isoccupied(i), isurgent(i), dc.sel); |
502 drawsquare(c && c->tags[i], isoccupied(i), isurgent(i), dc.sel); |
632 drawbar(); |
632 drawbar(); |
633 } |
633 } |
634 |
634 |
635 void |
635 void |
636 focus(Client *c) { |
636 focus(Client *c) { |
637 if(!c || (c && !isvisible(c, NULL))) |
637 if(!c || (c && !isvisible(c))) |
638 for(c = stack; c && !isvisible(c, NULL); c = c->snext); |
638 for(c = stack; c && !isvisible(c); c = c->snext); |
639 if(sel && sel != c) { |
639 if(sel && sel != c) { |
640 grabbuttons(sel, False); |
640 grabbuttons(sel, False); |
641 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
641 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
642 } |
642 } |
643 if(c) { |
643 if(c) { |
667 focusnext(const char *arg) { |
667 focusnext(const char *arg) { |
668 Client *c; |
668 Client *c; |
669 |
669 |
670 if(!sel) |
670 if(!sel) |
671 return; |
671 return; |
672 for(c = sel->next; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next); |
672 for(c = sel->next; c && !isvisible(c); c = c->next); |
673 if(!c) |
673 if(!c) |
674 for(c = clients; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next); |
674 for(c = clients; c && !isvisible(c); c = c->next); |
675 if(c) { |
675 if(c) { |
676 focus(c); |
676 focus(c); |
677 restack(); |
677 restack(); |
678 } |
678 } |
679 } |
679 } |
682 focusprev(const char *arg) { |
682 focusprev(const char *arg) { |
683 Client *c; |
683 Client *c; |
684 |
684 |
685 if(!sel) |
685 if(!sel) |
686 return; |
686 return; |
687 for(c = sel->prev; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev); |
687 for(c = sel->prev; c && !isvisible(c); c = c->prev); |
688 if(!c) { |
688 if(!c) { |
689 for(c = clients; c && c->next; c = c->next); |
689 for(c = clients; c && c->next; c = c->next); |
690 for(; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev); |
690 for(; c && !isvisible(c); c = c->prev); |
691 } |
691 } |
692 if(c) { |
692 if(c) { |
693 focus(c); |
693 focus(c); |
694 restack(); |
694 restack(); |
695 } |
695 } |
886 return True; |
886 return True; |
887 return False; |
887 return False; |
888 } |
888 } |
889 |
889 |
890 Bool |
890 Bool |
891 isvisible(Client *c, Bool *cmp) { |
891 isvisible(Client *c) { |
892 unsigned int i; |
892 unsigned int i; |
893 |
893 |
894 if(!cmp) |
|
895 cmp = tagset[seltags]; |
|
896 for(i = 0; i < LENGTH(tags); i++) |
894 for(i = 0; i < LENGTH(tags); i++) |
897 if(c->tags[i] && cmp[i]) |
895 if(c->tags[i] && tagset[seltags][i]) |
898 return True; |
896 return True; |
899 return False; |
897 return False; |
900 } |
898 } |
901 |
899 |
902 void |
900 void |
1017 void |
1015 void |
1018 monocle(void) { |
1016 monocle(void) { |
1019 Client *c; |
1017 Client *c; |
1020 |
1018 |
1021 for(c = clients; c; c = c->next) |
1019 for(c = clients; c; c = c->next) |
1022 if(!c->isfloating && isvisible(c, NULL)) |
1020 if(!c->isfloating && isvisible(c)) |
1023 resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); |
1021 resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); |
1024 } |
1022 } |
1025 |
1023 |
1026 void |
1024 void |
1027 movemouse(Client *c) { |
1025 movemouse(Client *c) { |
1068 } |
1066 } |
1069 } |
1067 } |
1070 |
1068 |
1071 Client * |
1069 Client * |
1072 nextunfloating(Client *c) { |
1070 nextunfloating(Client *c) { |
1073 for(; c && (c->isfloating || !isvisible(c, NULL)); c = c->next); |
1071 for(; c && (c->isfloating || !isvisible(c)); c = c->next); |
1074 return c; |
1072 return c; |
1075 } |
1073 } |
1076 |
1074 |
1077 void |
1075 void |
1078 propertynotify(XEvent *e) { |
1076 propertynotify(XEvent *e) { |
1228 XRaiseWindow(dpy, sel->win); |
1226 XRaiseWindow(dpy, sel->win); |
1229 if(lt->arrange) { |
1227 if(lt->arrange) { |
1230 wc.stack_mode = Below; |
1228 wc.stack_mode = Below; |
1231 wc.sibling = barwin; |
1229 wc.sibling = barwin; |
1232 for(c = stack; c; c = c->snext) |
1230 for(c = stack; c; c = c->snext) |
1233 if(!c->isfloating && isvisible(c, NULL)) { |
1231 if(!c->isfloating && isvisible(c)) { |
1234 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
1232 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
1235 wc.sibling = c->win; |
1233 wc.sibling = c->win; |
1236 } |
1234 } |
1237 } |
1235 } |
1238 XSync(dpy, False); |
1236 XSync(dpy, False); |