Xinqi Bao's Git
3270160d2e1d72022c728d66dba7f50cc4eeba2f
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
21 for(p
= clients
; p
&& p
->next
&& p
->weight
<= c
->weight
; p
= p
->next
);
24 if((c
->next
= p
->next
))
35 void (*arrange
)(Arg
*) = DEFMODE
;
41 c
->prev
->next
= c
->next
;
43 c
->next
->prev
= c
->prev
;
46 c
->next
= c
->prev
= NULL
;
54 for(c
= clients
; c
; c
= c
->next
) {
57 resize(c
, True
, TopLeft
);
62 if(!sel
|| !isvisible(sel
))
63 sel
= getnext(clients
);
67 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
78 for(n
= 0, c
= clients
; c
; c
= c
->next
)
79 if(isvisible(c
) && !c
->isfloat
)
83 h
= (sh
- bh
) / (n
- 1);
87 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
91 resize(c
, True
, TopLeft
);
108 c
->y
= sy
+ (i
- 1) * h
+ bh
;
111 c
->h
= sh
- c
->y
- 2;
115 else { /* fallback if h < bh */
121 resize(c
, False
, TopLeft
);
127 if(!sel
|| !isvisible(sel
))
128 sel
= getnext(clients
);
132 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
144 if(!(c
= getnext(sel
->next
)))
145 c
= getnext(clients
);
160 if(!(c
= getprev(sel
->prev
))) {
161 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
175 for(i
= 0; i
< ntags
; i
++)
176 if(c
->tags
[i
] && seltag
[i
])
184 static unsigned int nwins
= 0;
185 static Window
*wins
= NULL
;
186 unsigned int f
, fi
, m
, mi
, n
;
190 for(f
= 0, m
= 0, c
= clients
; c
; c
= c
->next
)
192 if(c
->isfloat
|| arrange
== dofloat
)
197 if(!(n
= 2 * (f
+ m
))) {
203 wins
= erealloc(wins
, nwins
* sizeof(Window
));
208 if(sel
->isfloat
|| arrange
== dofloat
) {
209 wins
[fi
++] = sel
->twin
;
210 wins
[fi
++] = sel
->win
;
213 wins
[mi
++] = sel
->twin
;
214 wins
[mi
++] = sel
->win
;
216 for(c
= clients
; c
; c
= c
->next
)
217 if(isvisible(c
) && c
!= sel
) {
218 if(c
->isfloat
|| arrange
== dofloat
) {
219 wins
[fi
++] = c
->twin
;
223 wins
[mi
++] = c
->twin
;
227 XRestackWindows(dpy
, wins
, n
);
230 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
236 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
248 seltag
[arg
->i
] = !seltag
[arg
->i
];
249 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
251 seltag
[arg
->i
] = True
; /* cannot toggle last view */
262 for(i
= 0; i
< ntags
; i
++)
264 seltag
[arg
->i
] = True
;
274 if(!c
|| (arrange
!= dotile
) || c
->isfloat
|| c
->ismax
)
277 if(c
== getnext(clients
))
278 if(!(c
= getnext(c
->next
)))