Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
13 static Layout
*lt
= NULL
;
16 floating(void) { /* default floating layout */
19 for(c
= clients
; c
; c
= c
->next
)
21 resize(c
, c
->x
, c
->y
, c
->w
, c
->h
, True
);
24 static unsigned int nlayouts
= 0;
34 for(c
= clients
; c
; c
= c
->next
)
45 focusclient(const char *arg
) {
51 for(c
= sel
->prev
; c
&& !isvisible(c
); c
= c
->prev
);
53 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
54 for(; c
&& !isvisible(c
); c
= c
->prev
);
58 for(c
= sel
->next
; c
&& !isvisible(c
); c
= c
->next
);
60 for(c
= clients
; c
&& !isvisible(c
); c
= c
->next
);
76 return lt
->arrange
== floating
;
80 isarrange(void (*func
)())
82 return func
== lt
->arrange
;
90 nlayouts
= sizeof layout
/ sizeof layout
[0];
91 for(blw
= i
= 0; i
< nlayouts
; i
++) {
92 w
= textw(layout
[i
].symbol
);
99 nexttiled(Client
*c
) {
100 for(; c
&& (c
->isfloating
|| !isvisible(c
)); c
= c
->next
);
113 if(sel
->isfloating
|| lt
->arrange
== floating
)
114 XRaiseWindow(dpy
, sel
->win
);
115 if(lt
->arrange
!= floating
) {
116 wc
.stack_mode
= Below
;
118 if(!sel
->isfloating
) {
119 XConfigureWindow(dpy
, sel
->win
, CWSibling
| CWStackMode
, &wc
);
120 wc
.sibling
= sel
->win
;
122 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
125 XConfigureWindow(dpy
, c
->win
, CWSibling
| CWStackMode
, &wc
);
130 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
134 setlayout(const char *arg
) {
139 if(lt
== layout
+ nlayouts
)
144 if(i
< 0 || i
>= nlayouts
)
155 togglebar(const char *arg
) {
157 bpos
= (BARPOS
== BarOff
) ? BarTop
: BARPOS
;
165 togglemax(const char *arg
) {
168 if(!sel
|| (lt
->arrange
!= floating
&& !sel
->isfloating
) || sel
->isfixed
)
170 if((sel
->ismax
= !sel
->ismax
)) {
175 resize(sel
, wax
, way
, waw
- 2 * sel
->border
, wah
- 2 * sel
->border
, True
);
178 resize(sel
, sel
->rx
, sel
->ry
, sel
->rw
, sel
->rh
, True
);
180 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));