-void
-floating(Arg *arg)
-{
- Client *c;
-
- arrange = floating;
- for(c = clients; c; c = c->next) {
- if(c->tags[tsel])
- resize(c);
- else
- ban_client(c);
- }
- if(sel && !sel->tags[tsel]) {
- if((sel = next(clients))) {
- craise(sel);
- focus(sel);
- }
- }
- discard_events(EnterWindowMask);
-}
-
-void
-tiling(Arg *arg)
-{
- Client *c;
- int n, cols, rows, gw, gh, i, j;
- float rt, fd;
-
- arrange = tiling;
- for(n = 0, c = clients; c; c = next(c->next), n++);
- if(n) {
- rt = sqrt(n);
- if(modff(rt, &fd) < 0.5)
- rows = floor(rt);
- else
- rows = ceil(rt);
- if(rows * rows < n)
- cols = rows + 1;
- else
- cols = rows;
-
- gw = (sw - 2) / cols;
- gh = (sh - 2) / rows;
- }
- else
- cols = rows = gw = gh = 0;
-
- for(i = j = 0, c = clients; c; c = c->next) {
- if(c->tags[tsel]) {
- c->x = i * gw;
- c->y = j * gh;
- c->w = gw;
- c->h = gh;
- resize(c);
- if(++i == cols) {
- j++;
- i = 0;
- }
- }
- else
- ban_client(c);
- }
- if(sel && !sel->tags[tsel]) {
- if((sel = next(clients))) {
- craise(sel);
- focus(sel);
- }
- }
- discard_events(EnterWindowMask);
-}
-
-void
-prevc(Arg *arg)
-{
- Client *c;
-
- if(!sel)
- return;
-
- if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) {
- craise(c);
- center(c);
- focus(c);
- }
-}
-
-void
-nextc(Arg *arg)
-{
- Client *c;
-
- if(!sel)
- return;
-
- if(!(c = next(sel->next)))
- c = next(clients);
- if(c) {
- craise(c);
- center(c);
- c->revert = sel;
- focus(c);
- }
-}
-
-void
-ckill(Arg *arg)
-{
- if(!sel)
- return;
- if(sel->proto & WM_PROTOCOL_DELWIN)
- send_message(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
- else
- XKillClient(dpy, sel->win);
-}
-