tmerged focus{prev.next} into focusclient(1/-1) - dwm - [fork] customized build… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 27b0595af72060d7cc406639b6c53a854f0a3590 | |
parent 12d5a26fd279cc2370954929dedf88d0ab205a16 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Thu, 22 Feb 2007 15:25:19 +0100 | |
merged focus{prev.next} into focusclient(1/-1) | |
Diffstat: | |
M config.arg.h | 4 ++-- | |
M config.default.h | 4 ++-- | |
M dwm.h | 3 +-- | |
M layout.c | 36 ++++++++++++++---------------… | |
4 files changed, 21 insertions(+), 26 deletions(-) | |
--- | |
diff --git a/config.arg.h b/config.arg.h | |
t@@ -52,8 +52,8 @@ static Key key[] = { \ | |
{ MODKEY, XK_i, incnmaster, … | |
{ MODKEY, XK_h, incmasterw, … | |
{ MODKEY, XK_l, incmasterw, … | |
- { MODKEY, XK_j, focusnext, … | |
- { MODKEY, XK_k, focusprev, … | |
+ { MODKEY, XK_j, focusclient, … | |
+ { MODKEY, XK_k, focusclient, … | |
{ MODKEY, XK_m, togglemax, … | |
{ MODKEY, XK_Return, zoom, … | |
{ MODKEY|ShiftMask, XK_space, toggleversatile,NU… | |
diff --git a/config.default.h b/config.default.h | |
t@@ -48,8 +48,8 @@ static Key key[] = { \ | |
{ MODKEY, XK_i, incnmaster, … | |
{ MODKEY, XK_g, incmasterw, … | |
{ MODKEY, XK_s, incmasterw, … | |
- { MODKEY, XK_Tab, focusnext, … | |
- { MODKEY|ShiftMask, XK_Tab, focusprev, … | |
+ { MODKEY, XK_Tab, focusclient, … | |
+ { MODKEY|ShiftMask, XK_Tab, focusclient,… | |
{ MODKEY, XK_m, togglemax, … | |
{ MODKEY, XK_Return, zoom, … | |
{ MODKEY|ShiftMask, XK_space, toggleversatile,NU… | |
diff --git a/dwm.h b/dwm.h | |
t@@ -119,8 +119,7 @@ extern unsigned int textw(const char *text); /* ret… | |
extern void grabkeys(void); /* grab all keys defined in… | |
/* layout.c */ | |
-extern void focusnext(const char *arg); /* focuses next visible… | |
-extern void focusprev(const char *arg); /* focuses previous vis… | |
+extern void focusclient(const char *arg); /* focuses next(1)/previous(-… | |
extern void incmasterw(const char *arg); /* increments the master width… | |
extern void incnmaster(const char *arg); /* increments nmaster with arg… | |
extern void initlayouts(void); /* initialize layout arr… | |
diff --git a/layout.c b/layout.c | |
t@@ -70,30 +70,26 @@ LAYOUTS | |
/* extern */ | |
void | |
-focusnext(const char *arg) { | |
+focusclient(const char *arg) { | |
Client *c; | |
- if(!sel) | |
+ if(!sel || !arg) | |
return; | |
- for(c = sel->next; c && !isvisible(c); c = c->next); | |
- if(!c) | |
- for(c = clients; c && !isvisible(c); c = c->next); | |
- if(c) { | |
- focus(c); | |
- restack(); | |
- } | |
-} | |
- | |
-void | |
-focusprev(const char *arg) { | |
- Client *c; | |
- | |
- if(!sel) | |
+ switch(atoi(arg)) { | |
+ default: | |
return; | |
- for(c = sel->prev; c && !isvisible(c); c = c->prev); | |
- if(!c) { | |
- for(c = clients; c && c->next; c = c->next); | |
- for(; c && !isvisible(c); c = c->prev); | |
+ case 1: | |
+ for(c = sel->next; c && !isvisible(c); c = c->next); | |
+ if(!c) | |
+ for(c = clients; c && !isvisible(c); c = c->next); | |
+ break; | |
+ case -1: | |
+ for(c = sel->prev; c && !isvisible(c); c = c->prev); | |
+ if(!c) { | |
+ for(c = clients; c && c->next; c = c->next); | |
+ for(; c && !isvisible(c); c = c->prev); | |
+ } | |
+ break; | |
} | |
if(c) { | |
focus(c); |