summaryrefslogtreecommitdiffstats
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
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 '')
-rw-r--r--client.c46
-rw-r--r--dwm.h8
-rw-r--r--layout.c46
3 files changed, 50 insertions, 50 deletions
diff --git a/client.c b/client.c
index fdb973c..c962c39 100644
--- a/client.c
+++ b/client.c
@@ -171,38 +171,6 @@ focus(Client *c) {
171} 171}
172 172
173void 173void
174focusnext(Arg *arg) {
175 Client *c;
176
177 if(!sel)
178 return;
179 for(c = sel->next; c && !isvisible(c); c = c->next);
180 if(!c)
181 for(c = clients; c && !isvisible(c); c = c->next);
182 if(c) {
183 focus(c);
184 restack();
185 }
186}
187
188void
189focusprev(Arg *arg) {
190 Client *c;
191
192 if(!sel)
193 return;
194 for(c = sel->prev; c && !isvisible(c); c = c->prev);
195 if(!c) {
196 for(c = clients; c && c->next; c = c->next);
197 for(; c && !isvisible(c); c = c->prev);
198 }
199 if(c) {
200 focus(c);
201 restack();
202 }
203}
204
205void
206killclient(Arg *arg) { 174killclient(Arg *arg) {
207 if(!sel) 175 if(!sel)
208 return; 176 return;
@@ -266,12 +234,6 @@ manage(Window w, XWindowAttributes *wa) {
266 lt->arrange(); 234 lt->arrange();
267} 235}
268 236
269Client *
270nexttiled(Client *c) {
271 for(; c && (c->isversatile || !isvisible(c)); c = c->next);
272 return c;
273}
274
275void 237void
276resize(Client *c, int x, int y, int w, int h, Bool sizehints) { 238resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
277 float actual, dx, dy, max, min; 239 float actual, dx, dy, max, min;
@@ -341,6 +303,14 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
341} 303}
342 304
343void 305void
306toggleversatile(Arg *arg) {
307 if(!sel || lt->arrange == versatile)
308 return;
309 sel->isversatile = !sel->isversatile;
310 lt->arrange();
311}
312
313void
344updatesizehints(Client *c) { 314updatesizehints(Client *c) {
345 long msize; 315 long msize;
346 XSizeHints size; 316 XSizeHints size;
diff --git a/dwm.h b/dwm.h
index 2ae48fa..2751c9e 100644
--- a/dwm.h
+++ b/dwm.h
@@ -105,13 +105,11 @@ extern Window root, barwin;
105/* client.c */ 105/* client.c */
106extern void configure(Client *c); /* send synthetic configure event */ 106extern void configure(Client *c); /* send synthetic configure event */
107extern void focus(Client *c); /* focus c, c may be NULL */ 107extern void focus(Client *c); /* focus c, c may be NULL */
108extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
109extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
110extern void killclient(Arg *arg); /* kill c nicely */ 108extern void killclient(Arg *arg); /* kill c nicely */
111extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ 109extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
112extern Client *nexttiled(Client *c); /* returns tiled successor of c */
113extern void resize(Client *c, int x, int y, 110extern void resize(Client *c, int x, int y,
114 int w, int h, Bool sizehints); /* resize with given coordinates c*/ 111 int w, int h, Bool sizehints); /* resize with given coordinates c*/
112extern void toggleversatile(Arg *arg); /* toggles focused client between versatile/and non-versatile state */
115extern void updatesizehints(Client *c); /* update the size hint variables of c */ 113extern void updatesizehints(Client *c); /* update the size hint variables of c */
116extern void updatetitle(Client *c); /* update the name of c */ 114extern void updatetitle(Client *c); /* update the name of c */
117extern void unmanage(Client *c); /* destroy c */ 115extern void unmanage(Client *c); /* destroy c */
@@ -127,12 +125,14 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/
127extern void grabkeys(void); /* grab all keys defined in config.h */ 125extern void grabkeys(void); /* grab all keys defined in config.h */
128 126
129/* layout.c */ 127/* layout.c */
128extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
129extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
130extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ 130extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */
131extern void initlayouts(void); /* initialize layout array */ 131extern void initlayouts(void); /* initialize layout array */
132extern Client *nexttiled(Client *c); /* returns tiled successor of c */
132extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ 133extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */
133extern void restack(void); /* restores z layers of all clients */ 134extern void restack(void); /* restores z layers of all clients */
134extern void setlayout(Arg *arg); /* sets layout, -1 toggles */ 135extern void setlayout(Arg *arg); /* sets layout, -1 toggles */
135extern void toggleversatile(Arg *arg); /* toggles focusesd client between versatile/and non-versatile state */
136extern void versatile(void); /* arranges all windows versatile */ 136extern void versatile(void); /* arranges all windows versatile */
137 137
138/* main.c */ 138/* main.c */
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