2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
15 for(min = c = clients; c; c = c->next)
16 if(c->weight < min->weight)
25 Client *c, *newclients, *tail;
27 newclients = tail = NULL;
28 while((c = minclient())) {
36 tail = newclients = c;
44 for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
50 void (*arrange)(Arg *) = DEFMODE;
56 c->prev->next = c->next;
58 c->next->prev = c->prev;
61 c->next = c->prev = NULL;
71 for(c = clients; c; c = c->next) {
73 resize(c, True, TopLeft);
78 if(!sel || !isvisible(sel))
79 focus(getnext(clients));
92 for(n = 0, c = clients; c; c = c->next)
93 if(isvisible(c) && !c->isfloat)
97 h = (sh - bh) / (n - 1);
101 for(i = 0, c = clients; c; c = c->next) {
104 resize(c, True, TopLeft);
121 c->y = sy + (i - 1) * h + bh;
124 c->h = sh - c->y - 2;
128 else { /* fallback if h < bh */
134 resize(c, False, TopLeft);
140 if(!sel || !isvisible(sel))
141 focus(getnext(clients));
153 if(!(c = getnext(sel->next)))
154 c = getnext(clients);
169 if(!(c = getprev(sel->prev))) {
170 for(c = clients; c && c->next; c = c->next);
184 for(i = 0; i < ntags; i++)
185 if(c->tags[i] && seltag[i])
196 for(n = 0, c = clients; c; c = c->next)
197 if(isvisible(c) && !c->isfloat)
199 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
202 if(sel == getnext(clients)) {
203 if(mw + arg->i > sw - 100 || mw + arg->i < 100)
208 if(mw - arg->i > sw - 100 || mw - arg->i < 100)
225 if(sel->isfloat || arrange == dofloat) {
226 XRaiseWindow(dpy, sel->win);
227 XRaiseWindow(dpy, sel->twin);
229 if(arrange != dofloat)
230 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
231 XLowerWindow(dpy, c->twin);
232 XLowerWindow(dpy, c->win);
236 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
242 arrange = (arrange == dofloat) ? dotile : dofloat;
254 seltag[arg->i] = !seltag[arg->i];
255 for(i = 0; i < ntags && !seltag[i]; i++);
257 seltag[arg->i] = True; /* cannot toggle last view */
267 for(i = 0; i < ntags; i++)
269 seltag[arg->i] = True;
279 for(i = 0; i < ntags; i++)
291 for(n = 0, c = clients; c; c = c->next)
292 if(isvisible(c) && !c->isfloat)
294 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
297 if((c = sel) == nexttiled(clients))
298 if(!(c = nexttiled(c->next)))