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
;
48 if((c
->ismax
= !c
->ismax
)) {
49 c
->rx
= c
->x
; c
->x
= sx
;
50 c
->ry
= c
->y
; c
->y
= bh
;
51 c
->rw
= c
->w
; c
->w
= sw
;
52 c
->rh
= c
->h
; c
->h
= sh
;
60 resize(c
, True
, TopLeft
);
61 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
66 void (*arrange
)(Arg
*) = DEFMODE
;
71 c
->prev
->next
= c
->next
;
73 c
->next
->prev
= c
->prev
;
76 c
->next
= c
->prev
= NULL
;
83 for(c
= clients
; c
; c
= c
->next
) {
85 resize(c
, True
, TopLeft
);
90 if(!sel
|| !isvisible(sel
)) {
91 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
103 for(n
= 0, c
= clients
; c
; c
= c
->next
)
114 h
= (sh
- bh
) / (n
- 1);
118 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
121 resize(c
, True
, TopLeft
);
138 c
->y
= sy
+ (i
- 1) * h
+ bh
;
141 c
->h
= sh
- c
->y
- 2;
145 else { /* fallback if h < bh */
151 resize(c
, False
, TopLeft
);
157 if(!sel
|| !isvisible(sel
)) {
158 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
165 focusnext(Arg
*arg
) {
171 if(!(c
= getnext(sel
->next
)))
172 c
= getnext(clients
);
180 focusprev(Arg
*arg
) {
186 if(!(c
= getprev(sel
->prev
))) {
187 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
197 isvisible(Client
*c
) {
200 for(i
= 0; i
< ntags
; i
++)
201 if(c
->tags
[i
] && seltag
[i
])
207 resizecol(Arg
*arg
) {
211 for(n
= 0, c
= clients
; c
; c
= c
->next
)
212 if(isvisible(c
) && !c
->isfloat
)
214 if(!sel
|| sel
->isfloat
|| n
< 2 || (arrange
!= dotile
))
217 if(sel
== getnext(clients
)) {
218 if(mw
+ arg
->i
> sw
- 100 || mw
+ arg
->i
< 100)
223 if(mw
- arg
->i
> sw
- 100 || mw
- arg
->i
< 100)
239 if(sel
->isfloat
|| arrange
== dofloat
) {
240 XRaiseWindow(dpy
, sel
->win
);
241 XRaiseWindow(dpy
, sel
->twin
);
243 if(arrange
!= dofloat
)
244 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
245 XLowerWindow(dpy
, c
->twin
);
246 XLowerWindow(dpy
, c
->win
);
250 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
254 togglemode(Arg
*arg
) {
255 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
263 toggleview(Arg
*arg
) {
266 seltag
[arg
->i
] = !seltag
[arg
->i
];
267 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
269 seltag
[arg
->i
] = True
; /* cannot toggle last view */
278 for(i
= 0; i
< ntags
; i
++)
280 seltag
[arg
->i
] = True
;
289 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
)))