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 focusnext(const char *arg
) {
50 for(c
= sel
->next
; c
&& !isvisible(c
); c
= c
->next
);
52 for(c
= clients
; c
&& !isvisible(c
); c
= c
->next
);
60 focusprev(const char *arg
) {
65 for(c
= sel
->prev
; c
&& !isvisible(c
); c
= c
->prev
);
67 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
68 for(; c
&& !isvisible(c
); c
= c
->prev
);
84 return lt
->arrange
== floating
;
88 isarrange(void (*func
)())
90 return func
== lt
->arrange
;
98 nlayouts
= sizeof layouts
/ sizeof layouts
[0];
99 for(blw
= i
= 0; i
< nlayouts
; i
++) {
100 w
= textw(layouts
[i
].symbol
);
107 nexttiled(Client
*c
) {
108 for(; c
&& (c
->isfloating
|| !isvisible(c
)); c
= c
->next
);
121 if(sel
->isfloating
|| lt
->arrange
== floating
)
122 XRaiseWindow(dpy
, sel
->win
);
123 if(lt
->arrange
!= floating
) {
124 wc
.stack_mode
= Below
;
126 if(!sel
->isfloating
) {
127 XConfigureWindow(dpy
, sel
->win
, CWSibling
| CWStackMode
, &wc
);
128 wc
.sibling
= sel
->win
;
130 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
133 XConfigureWindow(dpy
, c
->win
, CWSibling
| CWStackMode
, &wc
);
138 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
142 setlayout(const char *arg
) {
147 if(lt
== layouts
+ nlayouts
)
152 if(i
< 0 || i
>= nlayouts
)
163 togglebar(const char *arg
) {
165 bpos
= (BARPOS
== BarOff
) ? BarTop
: BARPOS
;
173 togglemax(const char *arg
) {
176 if(!sel
|| (lt
->arrange
!= floating
&& !sel
->isfloating
) || sel
->isfixed
)
178 if((sel
->ismax
= !sel
->ismax
)) {
183 resize(sel
, wax
, way
, waw
- 2 * sel
->border
, wah
- 2 * sel
->border
, True
);
186 resize(sel
, sel
->rx
, sel
->ry
, sel
->rw
, sel
->rh
, True
);
188 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));