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
- 2;
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
)
105 if(isvisible(c
) && !c
->isfloat
)
109 h
= (sh
- bh
) / (n
- 1);
113 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
116 resize(c
, True
, TopLeft
);
135 c
->y
= sy
+ (i
- 1) * h
+ bh
;
138 c
->h
= sh
- c
->y
- 2;
142 else { /* fallback if h < bh */
148 resize(c
, False
, TopLeft
);
154 if(!sel
|| !isvisible(sel
)) {
155 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
162 focusnext(Arg
*arg
) {
168 if(!(c
= getnext(sel
->next
)))
169 c
= getnext(clients
);
177 focusprev(Arg
*arg
) {
183 if(!(c
= getprev(sel
->prev
))) {
184 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
194 isvisible(Client
*c
) {
197 for(i
= 0; i
< ntags
; i
++)
198 if(c
->tags
[i
] && seltag
[i
])
204 resizecol(Arg
*arg
) {
208 for(n
= 0, c
= clients
; c
; c
= c
->next
)
209 if(isvisible(c
) && !c
->isfloat
)
211 if(!sel
|| sel
->isfloat
|| n
< 2 || (arrange
== dofloat
))
214 if(sel
== getnext(clients
)) {
215 if(mw
+ arg
->i
> sw
- 100 || mw
+ arg
->i
< 100)
220 if(mw
- arg
->i
> sw
- 100 || mw
- arg
->i
< 100)
236 if(sel
->isfloat
|| arrange
== dofloat
) {
237 XRaiseWindow(dpy
, sel
->win
);
238 XRaiseWindow(dpy
, sel
->twin
);
240 if(arrange
!= dofloat
)
241 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
242 XLowerWindow(dpy
, c
->twin
);
243 XLowerWindow(dpy
, c
->win
);
247 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
251 togglemode(Arg
*arg
) {
252 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
260 toggleview(Arg
*arg
) {
263 seltag
[arg
->i
] = !seltag
[arg
->i
];
264 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
266 seltag
[arg
->i
] = True
; /* cannot toggle last view */
275 for(i
= 0; i
< ntags
; i
++)
277 seltag
[arg
->i
] = True
;
286 for(i
= 0; i
< ntags
; i
++)
300 if(sel
->isfloat
|| (arrange
== dofloat
)) {
305 for(n
= 0, c
= clients
; c
; c
= c
->next
)
306 if(isvisible(c
) && !c
->isfloat
)
308 if(n
< 2 || (arrange
== dofloat
))
311 if((c
= sel
) == nexttiled(clients
))
312 if(!(c
= nexttiled(c
->next
)))