Xinqi Bao's Git
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
13 if((clients
&& clients
->isfloat
) || arrange
== dofloat
)
14 return clients
; /* don't touch floating order */
15 for(min
= c
= clients
; c
; c
= c
->next
)
16 if(c
->weight
< min
->weight
)
22 nexttiled(Client
*c
) {
23 for(c
= getnext(c
); c
&& c
->isfloat
; c
= getnext(c
->next
));
29 Client
*c
, *newclients
, *tail
;
31 newclients
= tail
= NULL
;
32 while((c
= minclient())) {
40 tail
= newclients
= c
;
49 if((c
->ismax
= !c
->ismax
)) {
50 c
->rx
= c
->x
; c
->x
= sx
;
51 c
->ry
= c
->y
; c
->y
= bh
;
52 c
->rw
= c
->w
; c
->w
= sw
;
53 c
->rh
= c
->h
; c
->h
= sh
- bh
;
61 resize(c
, True
, TopLeft
);
62 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
67 void (*arrange
)(Arg
*) = DEFMODE
;
72 c
->prev
->next
= c
->next
;
74 c
->next
->prev
= c
->prev
;
77 c
->next
= c
->prev
= NULL
;
84 for(c
= clients
; c
; c
= c
->next
) {
86 resize(c
, True
, TopLeft
);
91 if(!sel
|| !isvisible(sel
)) {
92 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
104 for(n
= 0, c
= clients
; c
; c
= c
->next
)
115 h
= (sh
- bh
) / (n
- 1);
119 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
122 resize(c
, True
, TopLeft
);
139 c
->y
= sy
+ (i
- 1) * h
+ bh
;
142 c
->h
= sh
- c
->y
- 2;
146 else { /* fallback if h < bh */
152 resize(c
, False
, TopLeft
);
158 if(!sel
|| !isvisible(sel
)) {
159 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
166 focusnext(Arg
*arg
) {
172 if(!(c
= getnext(sel
->next
)))
173 c
= getnext(clients
);
181 focusprev(Arg
*arg
) {
187 if(!(c
= getprev(sel
->prev
))) {
188 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
198 isvisible(Client
*c
) {
201 for(i
= 0; i
< ntags
; i
++)
202 if(c
->tags
[i
] && seltag
[i
])
208 resizecol(Arg
*arg
) {
212 for(n
= 0, c
= clients
; c
; c
= c
->next
)
213 if(isvisible(c
) && !c
->isfloat
)
215 if(!sel
|| sel
->isfloat
|| n
< 2 || (arrange
!= dotile
))
218 if(sel
== getnext(clients
)) {
219 if(mw
+ arg
->i
> sw
- 100 || mw
+ arg
->i
< 100)
224 if(mw
- arg
->i
> sw
- 100 || mw
- arg
->i
< 100)
240 if(sel
->isfloat
|| arrange
== dofloat
) {
241 XRaiseWindow(dpy
, sel
->win
);
242 XRaiseWindow(dpy
, sel
->twin
);
244 if(arrange
!= dofloat
)
245 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
246 XLowerWindow(dpy
, c
->twin
);
247 XLowerWindow(dpy
, c
->win
);
251 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
255 togglemode(Arg
*arg
) {
256 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
264 toggleview(Arg
*arg
) {
267 seltag
[arg
->i
] = !seltag
[arg
->i
];
268 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
270 seltag
[arg
->i
] = True
; /* cannot toggle last view */
279 for(i
= 0; i
< ntags
; i
++)
281 seltag
[arg
->i
] = True
;
290 for(i
= 0; i
< ntags
; i
++)
304 if(sel
->isfloat
|| (arrange
== dofloat
)) {
309 for(n
= 0, c
= clients
; c
; c
= c
->next
)
310 if(isvisible(c
) && !c
->isfloat
)
312 if(n
< 2 || (arrange
!= dotile
))
315 if((c
= sel
) == nexttiled(clients
))
316 if(!(c
= nexttiled(c
->next
)))