diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-05-22 14:15:30 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-05-22 14:15:30 +0100 |
| commit | cd3d83f571d1e3d9e765df448617ab859bbda584 (patch) | |
| tree | 65a9907bf70703a079a227b0abdda7e23ee10f9b | |
| parent | removed emallocz (diff) | |
| download | dwm-cd3d83f571d1e3d9e765df448617ab859bbda584.tar.gz dwm-cd3d83f571d1e3d9e765df448617ab859bbda584.zip | |
replaced isvisible with a macro
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 29 |
1 files changed, 12 insertions, 17 deletions
| @@ -52,6 +52,7 @@ | |||
| 52 | #define MAXTAGLEN 16 | 52 | #define MAXTAGLEN 16 |
| 53 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) | 53 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) |
| 54 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) | 54 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) |
| 55 | #define VISIBLE(x) ((x)->tags & tagset[seltags]) | ||
| 55 | 56 | ||
| 56 | /* enums */ | 57 | /* enums */ |
| 57 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | 58 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
| @@ -149,7 +150,6 @@ void initfont(const char *fontstr); | |||
| 149 | Bool isoccupied(uint t); | 150 | Bool isoccupied(uint t); |
| 150 | Bool isprotodel(Client *c); | 151 | Bool isprotodel(Client *c); |
| 151 | Bool isurgent(uint t); | 152 | Bool isurgent(uint t); |
| 152 | Bool isvisible(Client *c); | ||
| 153 | void keypress(XEvent *e); | 153 | void keypress(XEvent *e); |
| 154 | void killclient(const void *arg); | 154 | void killclient(const void *arg); |
| 155 | void manage(Window w, XWindowAttributes *wa); | 155 | void manage(Window w, XWindowAttributes *wa); |
| @@ -267,7 +267,7 @@ arrange(void) { | |||
| 267 | Client *c; | 267 | Client *c; |
| 268 | 268 | ||
| 269 | for(c = clients; c; c = c->next) | 269 | for(c = clients; c; c = c->next) |
| 270 | if(isvisible(c)) { | 270 | if(VISIBLE(c)) { |
| 271 | unban(c); | 271 | unban(c); |
| 272 | if(!lt->arrange || c->isfloating) | 272 | if(!lt->arrange || c->isfloating) |
| 273 | resize(c, c->x, c->y, c->w, c->h, True); | 273 | resize(c, c->x, c->y, c->w, c->h, True); |
| @@ -444,7 +444,7 @@ configurerequest(XEvent *e) { | |||
| 444 | if((ev->value_mask & (CWX|CWY)) | 444 | if((ev->value_mask & (CWX|CWY)) |
| 445 | && !(ev->value_mask & (CWWidth|CWHeight))) | 445 | && !(ev->value_mask & (CWWidth|CWHeight))) |
| 446 | configure(c); | 446 | configure(c); |
| 447 | if(isvisible(c)) | 447 | if(VISIBLE(c)) |
| 448 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); | 448 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
| 449 | } | 449 | } |
| 450 | else | 450 | else |
| @@ -497,7 +497,7 @@ drawbar(void) { | |||
| 497 | Client *c; | 497 | Client *c; |
| 498 | 498 | ||
| 499 | dc.x = 0; | 499 | dc.x = 0; |
| 500 | for(c = stack; c && !isvisible(c); c = c->snext); | 500 | for(c = stack; c && !VISIBLE(c); c = c->snext); |
| 501 | for(i = 0; i < LENGTH(tags); i++) { | 501 | for(i = 0; i < LENGTH(tags); i++) { |
| 502 | dc.w = textw(tags[i]); | 502 | dc.w = textw(tags[i]); |
| 503 | if(tagset[seltags] & 1 << i) { | 503 | if(tagset[seltags] & 1 << i) { |
| @@ -628,8 +628,8 @@ expose(XEvent *e) { | |||
| 628 | 628 | ||
| 629 | void | 629 | void |
| 630 | focus(Client *c) { | 630 | focus(Client *c) { |
| 631 | if(!c || (c && !isvisible(c))) | 631 | if(!c || (c && !VISIBLE(c))) |
| 632 | for(c = stack; c && !isvisible(c); c = c->snext); | 632 | for(c = stack; c && !VISIBLE(c); c = c->snext); |
| 633 | if(sel && sel != c) { | 633 | if(sel && sel != c) { |
| 634 | grabbuttons(sel, False); | 634 | grabbuttons(sel, False); |
| 635 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); | 635 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
| @@ -663,9 +663,9 @@ focusnext(const void *arg) { | |||
| 663 | 663 | ||
| 664 | if(!sel) | 664 | if(!sel) |
| 665 | return; | 665 | return; |
| 666 | for(c = sel->next; c && !isvisible(c); c = c->next); | 666 | for(c = sel->next; c && !VISIBLE(c); c = c->next); |
| 667 | if(!c) | 667 | if(!c) |
| 668 | for(c = clients; c && !isvisible(c); c = c->next); | 668 | for(c = clients; c && !VISIBLE(c); c = c->next); |
| 669 | if(c) { | 669 | if(c) { |
| 670 | focus(c); | 670 | focus(c); |
| 671 | restack(); | 671 | restack(); |
| @@ -678,10 +678,10 @@ focusprev(const void *arg) { | |||
| 678 | 678 | ||
| 679 | if(!sel) | 679 | if(!sel) |
| 680 | return; | 680 | return; |
| 681 | for(c = sel->prev; c && !isvisible(c); c = c->prev); | 681 | for(c = sel->prev; c && !VISIBLE(c); c = c->prev); |
| 682 | if(!c) { | 682 | if(!c) { |
| 683 | for(c = clients; c && c->next; c = c->next); | 683 | for(c = clients; c && c->next; c = c->next); |
| 684 | for(; c && !isvisible(c); c = c->prev); | 684 | for(; c && !VISIBLE(c); c = c->prev); |
| 685 | } | 685 | } |
| 686 | if(c) { | 686 | if(c) { |
| 687 | focus(c); | 687 | focus(c); |
| @@ -873,11 +873,6 @@ isurgent(uint t) { | |||
| 873 | return False; | 873 | return False; |
| 874 | } | 874 | } |
| 875 | 875 | ||
| 876 | Bool | ||
| 877 | isvisible(Client *c) { | ||
| 878 | return c->tags & tagset[seltags]; | ||
| 879 | } | ||
| 880 | |||
| 881 | void | 876 | void |
| 882 | keypress(XEvent *e) { | 877 | keypress(XEvent *e) { |
| 883 | uint i; | 878 | uint i; |
| @@ -1043,7 +1038,7 @@ movemouse(Client *c) { | |||
| 1043 | 1038 | ||
| 1044 | Client * | 1039 | Client * |
| 1045 | nexttiled(Client *c) { | 1040 | nexttiled(Client *c) { |
| 1046 | for(; c && (c->isfloating || !isvisible(c)); c = c->next); | 1041 | for(; c && (c->isfloating || !VISIBLE(c)); c = c->next); |
| 1047 | return c; | 1042 | return c; |
| 1048 | } | 1043 | } |
| 1049 | 1044 | ||
| @@ -1207,7 +1202,7 @@ restack(void) { | |||
| 1207 | wc.stack_mode = Below; | 1202 | wc.stack_mode = Below; |
| 1208 | wc.sibling = barwin; | 1203 | wc.sibling = barwin; |
| 1209 | for(c = stack; c; c = c->snext) | 1204 | for(c = stack; c; c = c->snext) |
| 1210 | if(!c->isfloating && isvisible(c)) { | 1205 | if(!c->isfloating && VISIBLE(c)) { |
| 1211 | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); | 1206 | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
| 1212 | wc.sibling = c->win; | 1207 | wc.sibling = c->win; |
| 1213 | } | 1208 | } |
