summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/dwm.c b/dwm.c
index d9e1c7f..3dc6f84 100644
--- a/dwm.c
+++ b/dwm.c
@@ -145,7 +145,7 @@ void initfont(const char *fontstr);
145Bool isoccupied(unsigned int t); 145Bool isoccupied(unsigned int t);
146Bool isprotodel(Client *c); 146Bool isprotodel(Client *c);
147Bool isurgent(unsigned int t); 147Bool isurgent(unsigned int t);
148Bool isvisible(Client *c, Bool *cmp); 148Bool isvisible(Client *c);
149void keypress(XEvent *e); 149void keypress(XEvent *e);
150void killclient(const char *arg); 150void killclient(const char *arg);
151void manage(Window w, XWindowAttributes *wa); 151void manage(Window w, XWindowAttributes *wa);
@@ -261,7 +261,7 @@ 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);
@@ -441,7 +441,7 @@ configurerequest(XEvent *e) {
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
@@ -494,7 +494,7 @@ drawbar(void) {
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]) {
@@ -634,8 +634,8 @@ expose(XEvent *e) {
634 634
635void 635void
636focus(Client *c) { 636focus(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]);
@@ -669,9 +669,9 @@ focusnext(const char *arg) {
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();
@@ -684,10 +684,10 @@ focusprev(const char *arg) {
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);
@@ -888,13 +888,11 @@ isurgent(unsigned int t) {
888} 888}
889 889
890Bool 890Bool
891isvisible(Client *c, Bool *cmp) { 891isvisible(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}
@@ -1019,7 +1017,7 @@ 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
@@ -1070,7 +1068,7 @@ movemouse(Client *c) {
1070 1068
1071Client * 1069Client *
1072nextunfloating(Client *c) { 1070nextunfloating(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
@@ -1230,7 +1228,7 @@ restack(void) {
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 }