- if(!stack)
- return;
- stack->x = sx;
- stack->y = bh;
- stack->w = sw - 2 * stack->border;
- stack->h = sh - bh - 2 * stack->border;
- resize(stack);
- discard_events(EnterWindowMask);
-}
-
-void
-arrange(void *aux)
-{
- Client *c;
- int n, cols, rows, gw, gh, i, j;
- float rt, fd;
-
- if(!clients)
- return;
- for(n = 0, c = clients; c; c = c->next, 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 - bh - 2) / rows;
-
- for(i = j = 0, c = clients; c; c = c->next) {
- c->x = i * gw;
- c->y = j * gh + bh;
- c->w = gw;
- c->h = gh;
- resize(c);
- if(++i == cols) {
- j++;
- i = 0;
- }
- }
- discard_events(EnterWindowMask);
-}
-
-void
-sel(void *aux)
-{
- const char *arg = aux;
- Client *c = NULL;
-
- if(!arg || !stack)
- return;
- if(!strncmp(arg, "next", 5))
- c = stack->snext ? stack->snext : stack;
- else if(!strncmp(arg, "prev", 5))
- for(c = stack; c && c->snext; c = c->snext);
- if(!c)
- c = stack;
- raise(c);
- focus(c);
-}
-
-void
-kill(void *aux)
-{
- Client *c = stack;
-
- if(!c)
- return;
- if(c->proto & WM_PROTOCOL_DELWIN)
- send_message(c->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
- else
- XKillClient(dpy, c->win);
+ XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty);