removed getnext/getprev, redundant
8a5f002c
3 file(s) · +7 −19
| 128 | 128 | ||
| 129 | 129 | /* tag.c */ |
|
| 130 | 130 | extern void initrregs(void); /* initialize regexps of rules defined in config.h */ |
|
| 131 | - | extern Client *getnext(Client *c); /* returns next visible client */ |
|
| 132 | - | extern Client *getprev(Client *c); /* returns previous visible client */ |
|
| 133 | 131 | extern void settags(Client *c, Client *trans); /* sets tags of c */ |
|
| 134 | 132 | extern void tag(Arg *arg); /* tags c with arg's index */ |
|
| 135 | 133 | extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ |
| 31 | 31 | ||
| 32 | 32 | /* extern */ |
|
| 33 | 33 | ||
| 34 | - | Client * |
|
| 35 | - | getnext(Client *c) { |
|
| 36 | - | for(; c && !isvisible(c); c = c->next); |
|
| 37 | - | return c; |
|
| 38 | - | } |
|
| 39 | - | ||
| 40 | - | Client * |
|
| 41 | - | getprev(Client *c) { |
|
| 42 | - | for(; c && !isvisible(c); c = c->prev); |
|
| 43 | - | return c; |
|
| 44 | - | } |
|
| 45 | - | ||
| 46 | 34 | void |
|
| 47 | 35 | initrregs(void) { |
|
| 48 | 36 | unsigned int i; |
| 8 | 8 | ||
| 9 | 9 | static Client * |
|
| 10 | 10 | nexttiled(Client *c) { |
|
| 11 | - | for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); |
|
| 11 | + | for(; c && (c->isfloat || !isvisible(c)); c = c->next); |
|
| 12 | 12 | return c; |
|
| 13 | 13 | } |
|
| 14 | 14 | ||
| 125 | 125 | ||
| 126 | 126 | if(!sel) |
|
| 127 | 127 | return; |
|
| 128 | - | if(!(c = getnext(sel->next))) |
|
| 129 | - | c = getnext(clients); |
|
| 128 | + | for(c = sel->next; c && !isvisible(c); c = c->next); |
|
| 129 | + | if(!c) |
|
| 130 | + | for(c = clients; c && !isvisible(c); c = c->next); |
|
| 130 | 131 | if(c) { |
|
| 131 | 132 | focus(c); |
|
| 132 | 133 | restack(); |
|
| 139 | 140 | ||
| 140 | 141 | if(!sel) |
|
| 141 | 142 | return; |
|
| 142 | - | if(!(c = getprev(sel->prev))) { |
|
| 143 | + | for(c = sel->prev; c && !isvisible(c); c = c->prev); |
|
| 144 | + | if(!c) { |
|
| 143 | 145 | for(c = clients; c && c->next; c = c->next); |
|
| 144 | - | c = getprev(c); |
|
| 146 | + | for(; c && !isvisible(c); c = c->prev); |
|
| 145 | 147 | } |
|
| 146 | 148 | if(c) { |
|
| 147 | 149 | focus(c); |
|