1 /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
2 * See LICENSE file for license details.
10 for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
15 togglemax(Client *c) {
21 if((c->ismax = !c->ismax)) {
22 c->rx = c->x; c->x = wax;
23 c->ry = c->y; c->y = way;
24 c->rw = c->w; c->w = waw - 2 * BORDERPX;
25 c->rh = c->h; c->h = wah - 2 * BORDERPX;
33 resize(c, True, TopLeft);
34 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
39 void (*arrange)(void) = DEFMODE;
44 c->prev->next = c->next;
46 c->next->prev = c->prev;
49 c->next = c->prev = NULL;
56 for(c = clients; c; c = c->next) {
58 resize(c, True, TopLeft);
63 if(!sel || !isvisible(sel)) {
64 for(c = stack; c && !isvisible(c); c = c->snext);
72 unsigned int i, n, mpx, stackw, th;
75 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
77 mpx = (waw * master) / 1000;
80 for(i = 0, c = clients; c; c = c->next)
83 resize(c, True, TopLeft);
89 if(n == 1) { /* only 1 window */
90 c->w = waw - 2 * BORDERPX;
91 c->h = wah - 2 * BORDERPX;
93 else if(i == 0) { /* master window */
94 c->w = mpx - 2 * BORDERPX;
95 c->h = wah - 2 * BORDERPX;
98 else { /* tile window */
100 c->w = stackw - 2 * BORDERPX;
102 c->y += (i - 1) * th;
103 c->h = th - 2 * BORDERPX;
105 else /* fallback if th < bh */
106 c->h = wah - 2 * BORDERPX;
108 resize(c, False, TopLeft);
114 if(!sel || !isvisible(sel)) {
115 for(c = stack; c && !isvisible(c); c = c->snext);
122 focusnext(Arg *arg) {
127 if(!(c = getnext(sel->next)))
128 c = getnext(clients);
136 focusprev(Arg *arg) {
141 if(!(c = getprev(sel->prev))) {
142 for(c = clients; c && c->next; c = c->next);
152 isvisible(Client *c) {
155 for(i = 0; i < ntags; i++)
156 if(c->tags[i] && seltag[i])
162 resizemaster(Arg *arg) {
166 if(master + arg->i > 950 || master + arg->i < 50)
182 if(sel->isfloat || arrange == dofloat) {
183 XRaiseWindow(dpy, sel->win);
184 XRaiseWindow(dpy, sel->twin);
186 if(arrange != dofloat) {
188 XLowerWindow(dpy, sel->twin);
189 XLowerWindow(dpy, sel->win);
191 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
194 XLowerWindow(dpy, c->twin);
195 XLowerWindow(dpy, c->win);
200 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
204 togglefloat(Arg *arg) {
205 if (!sel || arrange == dofloat)
207 sel->isfloat = !sel->isfloat;
212 togglemode(Arg *arg) {
213 arrange = (arrange == dofloat) ? dotile : dofloat;
221 toggleview(Arg *arg) {
224 seltag[arg->i] = !seltag[arg->i];
225 for(i = 0; i < ntags && !seltag[i]; i++);
227 seltag[arg->i] = True; /* cannot toggle last view */
235 for(i = 0; i < ntags; i++)
237 seltag[arg->i] = True;
245 for(i = 0; i < ntags; i++)
257 if(sel->isfloat || (arrange == dofloat)) {
261 for(n = 0, c = clients; c; c = c->next)
262 if(isvisible(c) && !c->isfloat)
264 if(n < 2 || (arrange == dofloat))
266 if((c = sel) == nexttiled(clients))
267 if(!(c = nexttiled(c->next)))