> Attached is a slightly different implementation of the fibonacci()
> function that respects `mfact' for the master window [and lets you
> resize your master window with M-j M-k] This worked under hg tip
> (1314). Comments, insights welcome. --Madhu
--snip--
Here's one that uses 'mfact' throughout. (I was annoyed that the
original code used a divisor of 2 rather than the golden ratio.)
void
fibonacci(int shape) {
unsigned int i, n, nx, ny, nw, nh;
Client *c;
nx = wx;
ny = wy;
nw = ww;
nh = wh;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;
for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
unsigned thish=nh, thisw=nw;
if((i % 2 && nh * mfact > 2 * c->bw)
|| (!(i % 2) && nw * mfact > 2 * c->bw))
{
if(i < n - 1) {
if(i % 2)
thish *= mfact, nh -= thish;
else
thisw *= mfact, nw -= thisw;
if((i % 4) == 2 && !shape)
nx += nw;
else if((i % 4) == 3 && !shape)
ny += nh;
}
i++;
}
resize(c, nx, ny, thisw - 2 * c->bw, thish - 2 * c-
>bw, False);
if((i % 4) == 0) {
if (shape)
ny += thish;
else
ny -= nh;
}
else if((i % 4) == 1)
nx += thisw;
else if((i % 4) == 2)
ny += thish;
else if((i % 4) == 3) {
if (shape)
nx += thisw;
else
nx -= nw;
}
}
focus(NULL);
restack();
}
Received on Tue Jul 29 2008 - 06:50:56 UTC
This archive was generated by hypermail 2.2.0 : Tue Jul 29 2008 - 08:00:08 UTC