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
- 2 * BORDERPX
;
53 c
->rh
= c
->h
; c
->h
= sh
- bh
- 2 * BORDERPX
;
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
);
100 unsigned int i
, n
, mpx
, stackw
, stackh
, th
;
103 for(n
= 0, c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
))
106 mpx
= (sw
* master
) / 1000;
114 for(i
= 0, c
= clients
; c
; c
= c
->next
, i
++)
117 resize(c
, True
, TopLeft
);
123 if(n
== 1) { /* only 1 window */
124 c
->w
= sw
- 2 * BORDERPX
;
125 c
->h
= sh
- 2 * BORDERPX
- bh
;
127 else if(i
== 0) { /* master window */
128 c
->w
= mpx
- 2 * BORDERPX
;
129 c
->h
= sh
- bh
- 2 * BORDERPX
;
131 else { /* tile window */
133 c
->w
= stackw
- 2 * BORDERPX
;
135 c
->y
= sy
+ (i
- 1) * th
+ bh
;
137 c
->h
= sh
- c
->y
- 2 * BORDERPX
;
139 c
->h
= th
- 2 * BORDERPX
;
141 else /* fallback if th < bh */
142 c
->h
= stackh
- 2 * BORDERPX
;
144 resize(c
, False
, TopLeft
);
148 if(!sel
|| !isvisible(sel
)) {
149 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
156 focusnext(Arg
*arg
) {
162 if(!(c
= getnext(sel
->next
)))
163 c
= getnext(clients
);
171 focusprev(Arg
*arg
) {
177 if(!(c
= getprev(sel
->prev
))) {
178 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
188 isvisible(Client
*c
) {
191 for(i
= 0; i
< ntags
; i
++)
192 if(c
->tags
[i
] && seltag
[i
])
198 resizecol(Arg
*arg
) {
202 for(n
= 0, c
= clients
; c
; c
= c
->next
)
203 if(isvisible(c
) && !c
->isfloat
)
205 if(!sel
|| sel
->isfloat
|| n
< 2 || (arrange
== dofloat
))
208 if(sel
== getnext(clients
)) {
209 if(master
+ arg
->i
> 950 || master
+ arg
->i
< 50)
214 if(master
- arg
->i
> 950 || master
- arg
->i
< 50)
230 if(sel
->isfloat
|| arrange
== dofloat
) {
231 XRaiseWindow(dpy
, sel
->win
);
232 XRaiseWindow(dpy
, sel
->twin
);
234 if(arrange
!= dofloat
) {
236 XLowerWindow(dpy
, sel
->twin
);
237 XLowerWindow(dpy
, sel
->win
);
239 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
242 XLowerWindow(dpy
, c
->twin
);
243 XLowerWindow(dpy
, c
->win
);
248 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
252 togglemode(Arg
*arg
) {
253 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
261 toggleview(Arg
*arg
) {
264 seltag
[arg
->i
] = !seltag
[arg
->i
];
265 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
267 seltag
[arg
->i
] = True
; /* cannot toggle last view */
276 for(i
= 0; i
< ntags
; i
++)
278 seltag
[arg
->i
] = True
;
287 for(i
= 0; i
< ntags
; i
++)
303 if(sel
->isfloat
|| (arrange
== dofloat
)) {
308 for(n
= 0, c
= clients
; c
; c
= c
->next
)
309 if(isvisible(c
) && !c
->isfloat
)
311 if(n
< 2 || (arrange
== dofloat
))
314 if((c
= sel
) == nexttiled(clients
))
315 if(!(c
= nexttiled(c
->next
)))