merged focus{prev.next} into focusclient(1/-1)
27b0595a
4 file(s) · +21 −26
| 52 | 52 | { MODKEY, XK_i, incnmaster, "1" }, \ |
|
| 53 | 53 | { MODKEY, XK_h, incmasterw, "-15" }, \ |
|
| 54 | 54 | { MODKEY, XK_l, incmasterw, "15" }, \ |
|
| 55 | - | { MODKEY, XK_j, focusnext, NULL }, \ |
|
| 56 | - | { MODKEY, XK_k, focusprev, NULL }, \ |
|
| 55 | + | { MODKEY, XK_j, focusclient, "1" }, \ |
|
| 56 | + | { MODKEY, XK_k, focusclient, "-1" }, \ |
|
| 57 | 57 | { MODKEY, XK_m, togglemax, NULL }, \ |
|
| 58 | 58 | { MODKEY, XK_Return, zoom, NULL }, \ |
|
| 59 | 59 | { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ |
| 48 | 48 | { MODKEY, XK_i, incnmaster, "1" }, \ |
|
| 49 | 49 | { MODKEY, XK_g, incmasterw, "15" }, \ |
|
| 50 | 50 | { MODKEY, XK_s, incmasterw, "-15" }, \ |
|
| 51 | - | { MODKEY, XK_Tab, focusnext, NULL }, \ |
|
| 52 | - | { MODKEY|ShiftMask, XK_Tab, focusprev, NULL }, \ |
|
| 51 | + | { MODKEY, XK_Tab, focusclient, "1" }, \ |
|
| 52 | + | { MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \ |
|
| 53 | 53 | { MODKEY, XK_m, togglemax, NULL }, \ |
|
| 54 | 54 | { MODKEY, XK_Return, zoom, NULL }, \ |
|
| 55 | 55 | { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ |
| 119 | 119 | extern void grabkeys(void); /* grab all keys defined in config.h */ |
|
| 120 | 120 | ||
| 121 | 121 | /* layout.c */ |
|
| 122 | - | extern void focusnext(const char *arg); /* focuses next visible client, arg is ignored */ |
|
| 123 | - | extern void focusprev(const char *arg); /* focuses previous visible client, arg is ignored */ |
|
| 122 | + | extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */ |
|
| 124 | 123 | extern void incmasterw(const char *arg); /* increments the master width with arg's index value */ |
|
| 125 | 124 | extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */ |
|
| 126 | 125 | extern void initlayouts(void); /* initialize layout array */ |
| 70 | 70 | /* extern */ |
|
| 71 | 71 | ||
| 72 | 72 | void |
|
| 73 | - | focusnext(const char *arg) { |
|
| 73 | + | focusclient(const char *arg) { |
|
| 74 | 74 | Client *c; |
|
| 75 | 75 | ||
| 76 | - | if(!sel) |
|
| 76 | + | if(!sel || !arg) |
|
| 77 | 77 | return; |
|
| 78 | - | for(c = sel->next; c && !isvisible(c); c = c->next); |
|
| 79 | - | if(!c) |
|
| 80 | - | for(c = clients; c && !isvisible(c); c = c->next); |
|
| 81 | - | if(c) { |
|
| 82 | - | focus(c); |
|
| 83 | - | restack(); |
|
| 84 | - | } |
|
| 85 | - | } |
|
| 86 | - | ||
| 87 | - | void |
|
| 88 | - | focusprev(const char *arg) { |
|
| 89 | - | Client *c; |
|
| 90 | - | ||
| 91 | - | if(!sel) |
|
| 78 | + | switch(atoi(arg)) { |
|
| 79 | + | default: |
|
| 92 | 80 | return; |
|
| 93 | - | for(c = sel->prev; c && !isvisible(c); c = c->prev); |
|
| 94 | - | if(!c) { |
|
| 95 | - | for(c = clients; c && c->next; c = c->next); |
|
| 96 | - | for(; c && !isvisible(c); c = c->prev); |
|
| 81 | + | case 1: |
|
| 82 | + | for(c = sel->next; c && !isvisible(c); c = c->next); |
|
| 83 | + | if(!c) |
|
| 84 | + | for(c = clients; c && !isvisible(c); c = c->next); |
|
| 85 | + | break; |
|
| 86 | + | case -1: |
|
| 87 | + | for(c = sel->prev; c && !isvisible(c); c = c->prev); |
|
| 88 | + | if(!c) { |
|
| 89 | + | for(c = clients; c && c->next; c = c->next); |
|
| 90 | + | for(; c && !isvisible(c); c = c->prev); |
|
| 91 | + | } |
|
| 92 | + | break; |
|
| 97 | 93 | } |
|
| 98 | 94 | if(c) { |
|
| 99 | 95 | focus(c); |