2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
14 if((clients && clients->isfloat) || arrange == dofloat)
15 return clients; /* don't touch floating order */
16 for(min = c = clients; c; c = c->next)
17 if(c->weight < min->weight)
24 Client *c, *newclients, *tail;
26 newclients = tail = NULL;
27 while((c = minclient())) {
35 tail = newclients = c;
41 nexttiled(Client *c) {
42 for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
48 void (*arrange)(Arg *) = DEFMODE;
53 c->prev->next = c->next;
55 c->next->prev = c->prev;
58 c->next = c->prev = NULL;
67 for(c = clients; c; c = c->next) {
69 resize(c, True, TopLeft);
74 if(!sel || !isvisible(sel)) {
75 for(c = stack; c && !isvisible(c); c = c->snext);
89 for(n = 0, c = clients; c; c = c->next)
90 if(isvisible(c) && !c->isfloat)
94 h = (sh - bh) / (n - 1);
98 for(i = 0, c = clients; c; c = c->next) {
101 resize(c, True, TopLeft);
118 c->y = sy + (i - 1) * h + bh;
121 c->h = sh - c->y - 2;
125 else { /* fallback if h < bh */
131 resize(c, False, TopLeft);
137 if(!sel || !isvisible(sel)) {
138 for(c = stack; c && !isvisible(c); c = c->snext);
145 focusnext(Arg *arg) {
151 if(!(c = getnext(sel->next)))
152 c = getnext(clients);
160 focusprev(Arg *arg) {
166 if(!(c = getprev(sel->prev))) {
167 for(c = clients; c && c->next; c = c->next);
177 isvisible(Client *c) {
180 for(i = 0; i < ntags; i++)
181 if(c->tags[i] && seltag[i])
187 resizecol(Arg *arg) {
191 for(n = 0, c = clients; c; c = c->next)
192 if(isvisible(c) && !c->isfloat)
194 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
197 if(sel == getnext(clients)) {
198 if(mw + arg->i > sw - 100 || mw + arg->i < 100)
203 if(mw - arg->i > sw - 100 || mw - arg->i < 100)
219 if(sel->isfloat || arrange == dofloat) {
220 XRaiseWindow(dpy, sel->win);
221 XRaiseWindow(dpy, sel->twin);
223 if(arrange != dofloat)
224 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
225 XLowerWindow(dpy, c->twin);
226 XLowerWindow(dpy, c->win);
230 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
234 togglemode(Arg *arg) {
235 arrange = (arrange == dofloat) ? dotile : dofloat;
243 toggleview(Arg *arg) {
246 seltag[arg->i] = !seltag[arg->i];
247 for(i = 0; i < ntags && !seltag[i]; i++);
249 seltag[arg->i] = True; /* cannot toggle last view */
258 for(i = 0; i < ntags; i++)
260 seltag[arg->i] = True;
269 for(i = 0; i < ntags; i++)
280 for(n = 0, c = clients; c; c = c->next)
281 if(isvisible(c) && !c->isfloat)
283 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
286 if((c = sel) == nexttiled(clients))
287 if(!(c = nexttiled(c->next)))