-appendtag(Arg *arg)
-{
- if(!sel)
- return;
-
- sel->tags[arg->i] = True;
- arrange(NULL);
-}
-
-void
-dofloat(Arg *arg)
-{
- Client *c;
-
- for(c = clients; c; c = c->next) {
- c->ismax = False;
- if(c->tags[tsel]) {
- resize(c, True, TopLeft);
- }
- else
- ban(c);
- }
- if(sel && !sel->tags[tsel]) {
- if((sel = getnext(clients))) {
- higher(sel);
- focus(sel);
- }
- else
- XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
- }
- drawall();
-}
-
-void
-dotile(Arg *arg)
-{
- int n, i, w, h;
- Client *c;
-
- w = sw - mw;
- for(n = 0, c = clients; c; c = c->next)
- if(c->tags[tsel] && !c->isfloat)
- n++;
-
- if(n > 1)
- h = (sh - bh) / (n - 1);
- else
- h = sh - bh;
-
- for(i = 0, c = clients; c; c = c->next) {
- c->ismax = False;
- if(c->tags[tsel]) {
- if(c->isfloat) {
- higher(c);
- resize(c, True, TopLeft);
- continue;
- }
- if(n == 1) {
- c->x = sx;
- c->y = sy + bh;
- c->w = sw - 2;
- c->h = sh - 2 - bh;
- }
- else if(i == 0) {
- c->x = sx;
- c->y = sy + bh;
- c->w = mw - 2;
- c->h = sh - 2 - bh;
- }
- else if(h > bh) {
- c->x = sx + mw;
- c->y = sy + (i - 1) * h + bh;
- c->w = w - 2;
- c->h = h - 2;
- }
- else { /* fallback if h < bh */
- c->x = sx + mw;
- c->y = sy + bh;
- c->w = w - 2;
- c->h = sh - 2 - bh;
- }
- resize(c, False, TopLeft);
- i++;
- }
- else
- ban(c);
- }
- if(!sel || (sel && !sel->tags[tsel])) {
- if((sel = getnext(clients))) {
- higher(sel);
- focus(sel);
- }
- else
- XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
- }
- drawall();
-}
-
-Client *
-getnext(Client *c)
-{
- for(; c && !c->tags[tsel]; c = c->next);
- return c;
-}
-
-Client *
-getprev(Client *c)
-{
- for(; c && !c->tags[tsel]; c = c->prev);
- return c;
-}
-
-void
-initrregs()
-{