1 /* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
2 * See LICENSE file for license details.
8 void (*arrange)(void) = DEFMODE;
13 c->prev->next = c->next;
15 c->next->prev = c->prev;
18 c->next = c->prev = NULL;
25 for(c = clients; c; c = c->next) {
28 XMoveWindow(dpy, c->win, c->x, c->y);
30 resize(c, c->x, c->y, c->w, c->h, True);
34 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
37 if(!sel || !isvisible(sel)) {
38 for(c = stack; c && !isvisible(c); c = c->snext);
50 for(c = sel->next; c && !isvisible(c); c = c->next);
52 for(c = clients; c && !isvisible(c); c = c->next);
65 for(c = sel->prev; c && !isvisible(c); c = c->prev);
67 for(c = clients; c && c->next; c = c->next);
68 for(; c && !isvisible(c); c = c->prev);
77 isvisible(Client *c) {
80 for(i = 0; i < ntags; i++)
81 if(c->tags[i] && seltag[i])
87 nextmanaged(Client *c) {
88 for(; c && (c->isfloat || !isvisible(c)); c = c->next);
100 if(sel->isfloat || arrange == dofloat)
101 XRaiseWindow(dpy, sel->win);
102 if(arrange != dofloat) {
104 XLowerWindow(dpy, sel->win);
105 for(c = nextmanaged(clients); c; c = nextmanaged(c->next)) {
108 XLowerWindow(dpy, c->win);
112 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
116 togglefloat(Arg *arg) {
117 if(!sel || arrange == dofloat)
119 sel->isfloat = !sel->isfloat;
124 togglemode(Arg *arg) {
125 arrange = (arrange == dofloat) ? dotile : dofloat;
133 toggleview(Arg *arg) {
136 seltag[arg->i] = !seltag[arg->i];
137 for(i = 0; i < ntags && !seltag[i]; i++);
139 seltag[arg->i] = True; /* cannot toggle last view */
147 for(i = 0; i < ntags; i++)
148 seltag[i] = (arg->i == -1) ? True : False;
149 if(arg->i >= 0 && arg->i < ntags)
150 seltag[arg->i] = True;