On Mon, Nov 7, 2011 at 11:15 AM, lolilolicon <[email protected]> wrote:
>
> * Port my original spiral layout to play with this patch.
I've simplified the spiral layout by rusing tile{h,v}. Nice.
void
spiral(Client *c, float fact, XRectangle *r, XRectangle *rp) {
if(fact == 0) {
rp->width = rp->height = 0;
return;
}
static int pos = 1;
float f = fact == 1 ? 1 : 0.5;
switch(pos) {
case 0: /* left */
tileh(c, f, r, rp);
pos = 1;
break;
case 1: /* top */
tilev(c, f, r, rp);
pos = 2;
break;
case 2: /* right */
tileh(c, f, &((XRectangle){ r->x + r->width * (1 - f), r->y, r->width, r->height }), rp);
r->width -= rp->width;
pos = 3;
break;
case 3: /* bottom */
tilev(c, f, &((XRectangle){ r->x, r->y + r->height * (1 - f), r->width, r->height }), rp);
r->height -= rp->height;
pos = 0;
break;
}
if(fact == 1)
pos = 1; /* reset to initial value */
}