Xinqi Bao's Git
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
9 void (*arrange
)(Arg
*) = DEFMODE
;
14 Client
*first
= getnext(clients
);
18 for(first
= clients
; first
->next
; first
= first
->next
);
25 else if(first
== clients
) {
31 first
->prev
->next
= c
;
32 c
->prev
= first
->prev
;
42 c
->prev
->next
= c
->next
;
44 c
->next
->prev
= c
->prev
;
47 c
->next
= c
->prev
= NULL
;
55 for(c
= clients
; c
; c
= c
->next
) {
58 resize(c
, True
, TopLeft
);
63 if(!sel
|| !isvisible(sel
))
64 sel
= getnext(clients
);
68 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
79 for(n
= 0, c
= clients
; c
; c
= c
->next
)
80 if(isvisible(c
) && !c
->isfloat
)
84 h
= (sh
- bh
) / (n
- 1);
88 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
92 resize(c
, True
, TopLeft
);
109 c
->y
= sy
+ (i
- 1) * h
+ bh
;
112 c
->h
= sh
- c
->y
- 2;
116 else { /* fallback if h < bh */
122 resize(c
, False
, TopLeft
);
128 if(!sel
|| !isvisible(sel
))
129 sel
= getnext(clients
);
133 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
145 if(!(c
= getnext(sel
->next
)))
146 c
= getnext(clients
);
161 if(!(c
= getprev(sel
->prev
))) {
162 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
176 for(i
= 0; i
< ntags
; i
++)
177 if(c
->tags
[i
] && seltag
[i
])
185 static unsigned int nwins
= 0;
186 static Window
*wins
= NULL
;
187 unsigned int f
, fi
, m
, mi
, n
;
191 for(f
= 0, m
= 0, c
= clients
; c
; c
= c
->next
)
193 if(c
->isfloat
|| arrange
== dofloat
)
198 if(!(n
= 2 * (f
+ m
))) {
204 wins
= erealloc(wins
, nwins
* sizeof(Window
));
209 if(sel
->isfloat
|| arrange
== dofloat
) {
210 wins
[fi
++] = sel
->twin
;
211 wins
[fi
++] = sel
->win
;
214 wins
[mi
++] = sel
->twin
;
215 wins
[mi
++] = sel
->win
;
217 for(c
= clients
; c
; c
= c
->next
)
218 if(isvisible(c
) && c
!= sel
) {
219 if(c
->isfloat
|| arrange
== dofloat
) {
220 wins
[fi
++] = c
->twin
;
224 wins
[mi
++] = c
->twin
;
228 XRestackWindows(dpy
, wins
, n
);
231 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
237 arrange
= (arrange
== dofloat
) ? dotile
: dofloat
;
249 seltag
[arg
->i
] = !seltag
[arg
->i
];
250 for(i
= 0; i
< ntags
&& !seltag
[i
]; i
++);
252 seltag
[arg
->i
] = True
; /* cannot toggle last view */
261 for(i
= 0; i
< ntags
; i
++)
263 seltag
[arg
->i
] = True
;
272 if(!c
|| (arrange
!= dotile
) || c
->isfloat
|| c
->ismax
)
275 if(c
== getnext(clients
))
276 if(!(c
= getnext(c
->next
)))