summaryrefslogtreecommitdiffstats
path: root/layout.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-21 11:39:57 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-21 11:39:57 +0100
commit29c26b88e7333fb8ea022c4bb4277bc0394ab9e3 (patch)
treef48255b650c9b8ecf252a2b6a5b0ca10b4158780 /layout.c
parentcleaned up and commented the config.*.h (diff)
downloaddwm-29c26b88e7333fb8ea022c4bb4277bc0394ab9e3.tar.gz
dwm-29c26b88e7333fb8ea022c4bb4277bc0394ab9e3.zip
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/layout.c b/layout.c
index d754afb..e5f635c 100644
--- a/layout.c
+++ b/layout.c
@@ -69,6 +69,38 @@ LAYOUTS
69/* extern */ 69/* extern */
70 70
71void 71void
72focusnext(Arg *arg) {
73 Client *c;
74
75 if(!sel)
76 return;
77 for(c = sel->next; c && !isvisible(c); c = c->next);
78 if(!c)
79 for(c = clients; c && !isvisible(c); c = c->next);
80 if(c) {
81 focus(c);
82 restack();
83 }
84}
85
86void
87focusprev(Arg *arg) {
88 Client *c;
89
90 if(!sel)
91 return;
92 for(c = sel->prev; c && !isvisible(c); c = c->prev);
93 if(!c) {
94 for(c = clients; c && c->next; c = c->next);
95 for(; c && !isvisible(c); c = c->prev);
96 }
97 if(c) {
98 focus(c);
99 restack();
100 }
101}
102
103void
72incnmaster(Arg *arg) { 104incnmaster(Arg *arg) {
73 if((lt->arrange != tile) || (nmaster + arg->i < 1) 105 if((lt->arrange != tile) || (nmaster + arg->i < 1)
74 || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) 106 || (wah / (nmaster + arg->i) <= 2 * BORDERPX))
@@ -93,6 +125,12 @@ initlayouts(void) {
93 } 125 }
94} 126}
95 127
128Client *
129nexttiled(Client *c) {
130 for(; c && (c->isversatile || !isvisible(c)); c = c->next);
131 return c;
132}
133
96void 134void
97resizemaster(Arg *arg) { 135resizemaster(Arg *arg) {
98 if(lt->arrange != tile) 136 if(lt->arrange != tile)
@@ -154,14 +192,6 @@ setlayout(Arg *arg) {
154} 192}
155 193
156void 194void
157toggleversatile(Arg *arg) {
158 if(!sel || lt->arrange == versatile)
159 return;
160 sel->isversatile = !sel->isversatile;
161 lt->arrange();
162}
163
164void
165versatile(void) { 195versatile(void) {
166 Client *c; 196 Client *c;
167 197