Xinqi Bao's Git
4781b4e6c4448b05c970ca9687ccdfa01cf37bc5
1 /* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
2 * See LICENSE file for license details.
8 void (*arrange
)(void) = DEFMODE
;
19 attachstack(Client
*c
) {
28 for(c
= clients
; c
; c
= c
->next
) {
31 XMoveWindow(dpy
, c
->win
, c
->x
, c
->y
);
33 resize(c
, c
->x
, c
->y
, c
->w
, c
->h
, True
);
37 XMoveWindow(dpy
, c
->win
, c
->x
+ 2 * sw
, c
->y
);
40 if(!sel
|| !isvisible(sel
)) {
41 for(c
= stack
; c
&& !isvisible(c
); c
= c
->snext
);
50 c
->prev
->next
= c
->next
;
52 c
->next
->prev
= c
->prev
;
55 c
->next
= c
->prev
= NULL
;
59 detachstack(Client
*c
) {
61 for(tc
=&stack
; *tc
&& *tc
!= c
; tc
=&(*tc
)->snext
);
71 for(c
= sel
->next
; c
&& !isvisible(c
); c
= c
->next
);
73 for(c
= clients
; c
&& !isvisible(c
); c
= c
->next
);
86 for(c
= sel
->prev
; c
&& !isvisible(c
); c
= c
->prev
);
88 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
89 for(; c
&& !isvisible(c
); c
= c
->prev
);
101 for(c
= clients
; c
; c
= c
->next
)
108 isvisible(Client
*c
) {
111 for(i
= 0; i
< ntags
; i
++)
112 if(c
->tags
[i
] && seltag
[i
])
118 nextmanaged(Client
*c
) {
119 for(; c
&& (c
->isfloat
|| !isvisible(c
)); c
= c
->next
);
131 if(sel
->isfloat
|| arrange
== dofloat
)
132 XRaiseWindow(dpy
, sel
->win
);
133 if(arrange
!= dofloat
) {
135 XLowerWindow(dpy
, sel
->win
);
136 for(c
= nextmanaged(clients
); c
; c
= nextmanaged(c
->next
)) {
139 XLowerWindow(dpy
, c
->win
);
143 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
147 togglefloat(Arg
*arg
) {
148 if(!sel
|| arrange
== dofloat
)
150 sel
->isfloat
= !sel
->isfloat
;
155 togglemode(Arg
*arg
) {
156 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
164 toggleview(Arg
*arg
) {
167 seltag
[arg
->i
] = !seltag
[arg
->i
];
168 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
170 seltag
[arg
->i
] = True
; /* cannot toggle last view */
178 for(i
= 0; i
< ntags
; i
++)
179 seltag
[i
] = (arg
->i
== -1) ? True
: False
;
180 if(arg
->i
>= 0 && arg
->i
< ntags
)
181 seltag
[arg
->i
] = True
;