equal
deleted
inserted
replaced
1 /* |
1 /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
3 * See LICENSE file for license details. |
2 * See LICENSE file for license details. |
4 */ |
3 */ |
5 #include "dwm.h" |
4 #include "dwm.h" |
6 |
5 |
7 /* static */ |
6 /* static */ |
41 } |
40 } |
42 clients = newclients; |
41 clients = newclients; |
43 } |
42 } |
44 |
43 |
45 static void |
44 static void |
46 togglemax(Client *c) |
45 togglemax(Client *c) { |
47 { |
|
48 XEvent ev; |
46 XEvent ev; |
|
47 |
49 if((c->ismax = !c->ismax)) { |
48 if((c->ismax = !c->ismax)) { |
50 c->rx = c->x; c->x = sx; |
49 c->rx = c->x; c->x = sx; |
51 c->ry = c->y; c->y = bh; |
50 c->ry = c->y; c->y = bh; |
52 c->rw = c->w; c->w = sw - 2 * BORDERPX; |
51 c->rw = c->w; c->w = sw - 2 * BORDERPX; |
53 c->rh = c->h; c->h = sh - bh - 2 * BORDERPX; |
52 c->rh = c->h; c->h = sh - bh - 2 * BORDERPX; |
100 unsigned int i, n, mpx, stackw, stackh, th; |
99 unsigned int i, n, mpx, stackw, stackh, th; |
101 Client *c; |
100 Client *c; |
102 |
101 |
103 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
102 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
104 n++; |
103 n++; |
105 |
|
106 mpx = (sw * master) / 1000; |
104 mpx = (sw * master) / 1000; |
107 stackw = sw - mpx; |
105 stackw = sw - mpx; |
108 stackh = sh - bh; |
106 stackh = sh - bh; |
109 |
|
110 th = stackh; |
107 th = stackh; |
111 if(n > 1) |
108 if(n > 1) |
112 th /= (n - 1); |
109 th /= (n - 1); |
113 |
110 |
114 for(i = 0, c = clients; c; c = c->next, i++) |
111 for(i = 0, c = clients; c; c = c->next, i++) |
143 } |
140 } |
144 resize(c, False, TopLeft); |
141 resize(c, False, TopLeft); |
145 } |
142 } |
146 else |
143 else |
147 ban(c); |
144 ban(c); |
|
145 |
148 if(!sel || !isvisible(sel)) { |
146 if(!sel || !isvisible(sel)) { |
149 for(c = stack; c && !isvisible(c); c = c->snext); |
147 for(c = stack; c && !isvisible(c); c = c->snext); |
150 focus(c); |
148 focus(c); |
151 } |
149 } |
152 restack(); |
150 restack(); |
156 focusnext(Arg *arg) { |
154 focusnext(Arg *arg) { |
157 Client *c; |
155 Client *c; |
158 |
156 |
159 if(!sel) |
157 if(!sel) |
160 return; |
158 return; |
161 |
|
162 if(!(c = getnext(sel->next))) |
159 if(!(c = getnext(sel->next))) |
163 c = getnext(clients); |
160 c = getnext(clients); |
164 if(c) { |
161 if(c) { |
165 focus(c); |
162 focus(c); |
166 restack(); |
163 restack(); |
171 focusprev(Arg *arg) { |
168 focusprev(Arg *arg) { |
172 Client *c; |
169 Client *c; |
173 |
170 |
174 if(!sel) |
171 if(!sel) |
175 return; |
172 return; |
176 |
|
177 if(!(c = getprev(sel->prev))) { |
173 if(!(c = getprev(sel->prev))) { |
178 for(c = clients; c && c->next; c = c->next); |
174 for(c = clients; c && c->next; c = c->next); |
179 c = getprev(c); |
175 c = getprev(c); |
180 } |
176 } |
181 if(c) { |
177 if(c) { |
202 for(n = 0, c = clients; c; c = c->next) |
198 for(n = 0, c = clients; c; c = c->next) |
203 if(isvisible(c) && !c->isfloat) |
199 if(isvisible(c) && !c->isfloat) |
204 n++; |
200 n++; |
205 if(!sel || sel->isfloat || n < 2 || (arrange == dofloat)) |
201 if(!sel || sel->isfloat || n < 2 || (arrange == dofloat)) |
206 return; |
202 return; |
207 |
|
208 if(sel == getnext(clients)) { |
203 if(sel == getnext(clients)) { |
209 if(master + arg->i > 950 || master + arg->i < 50) |
204 if(master + arg->i > 950 || master + arg->i < 50) |
210 return; |
205 return; |
211 master += arg->i; |
206 master += arg->i; |
212 } |
207 } |
288 seltag[i] = True; |
283 seltag[i] = True; |
289 reorder(); |
284 reorder(); |
290 arrange(NULL); |
285 arrange(NULL); |
291 } |
286 } |
292 |
287 |
293 |
|
294 |
|
295 void |
288 void |
296 zoom(Arg *arg) { |
289 zoom(Arg *arg) { |
297 unsigned int n; |
290 unsigned int n; |
298 Client *c; |
291 Client *c; |
299 |
292 |
300 if(!sel) |
293 if(!sel) |
301 return; |
294 return; |
302 |
|
303 if(sel->isfloat || (arrange == dofloat)) { |
295 if(sel->isfloat || (arrange == dofloat)) { |
304 togglemax(sel); |
296 togglemax(sel); |
305 return; |
297 return; |
306 } |
298 } |
307 |
|
308 for(n = 0, c = clients; c; c = c->next) |
299 for(n = 0, c = clients; c; c = c->next) |
309 if(isvisible(c) && !c->isfloat) |
300 if(isvisible(c) && !c->isfloat) |
310 n++; |
301 n++; |
311 if(n < 2 || (arrange == dofloat)) |
302 if(n < 2 || (arrange == dofloat)) |
312 return; |
303 return; |
313 |
|
314 if((c = sel) == nexttiled(clients)) |
304 if((c = sel) == nexttiled(clients)) |
315 if(!(c = nexttiled(c->next))) |
305 if(!(c = nexttiled(c->next))) |
316 return; |
306 return; |
317 detach(c); |
307 detach(c); |
318 if(clients) |
308 if(clients) |