+/* static */
+
+static Client *
+minclient(void) {
+ Client *c, *min;
+
+ if((clients && clients->isfloat) || arrange == dofloat)
+ return clients; /* don't touch floating order */
+ for(min = c = clients; c; c = c->next)
+ if(c->weight < min->weight)
+ min = c;
+ return min;
+}
+
+static Client *
+nexttiled(Client *c) {
+ for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
+ return c;
+}
+
+static void
+reorder(void) {
+ Client *c, *newclients, *tail;
+
+ newclients = tail = NULL;
+ while((c = minclient())) {
+ detach(c);
+ if(tail) {
+ c->prev = tail;
+ tail->next = c;
+ tail = c;
+ }
+ else
+ tail = newclients = c;
+ }
+ clients = newclients;
+}
+
+static void
+togglemax(Client *c)
+{
+ XEvent ev;
+ if((c->ismax = !c->ismax)) {
+ c->rx = c->x; c->x = sx;
+ c->ry = c->y; c->y = bh;
+ c->rw = c->w; c->w = sw;
+ c->rh = c->h; c->h = sh - bh - 2;
+ }
+ else {
+ c->x = c->rx;
+ c->y = c->ry;
+ c->w = c->rw;
+ c->h = c->rh;
+ }
+ resize(c, True, TopLeft);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+