mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Changes to make fibonacci layout arrangement pixel perfect
This commit is contained in:
parent
8aa7a8dafb
commit
69a9fe607a
@ -511,7 +511,7 @@ arrange_gapplessgrid_alt2(Monitor *m, int x, int y, int h, int w, int ih, int iv
|
|||||||
static void
|
static void
|
||||||
arrange_fibonacci(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai, int s)
|
arrange_fibonacci(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai, int s)
|
||||||
{
|
{
|
||||||
int i, j, nx = x, ny = y, nw = w, nh = h, r = 1;
|
int i, j, nv, hrest = 0, wrest = 0, nx = x, ny = y, nw = w, nh = h, r = 1;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for (i = 0, j = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), j++) {
|
for (i = 0, j = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), j++) {
|
||||||
@ -521,10 +521,15 @@ arrange_fibonacci(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n,
|
|||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
if (r && i < an - 1) {
|
if (r && i < an - 1) {
|
||||||
if (i % 2)
|
if (i % 2) {
|
||||||
nh = (nh - ih) / 2;
|
nv = (nh - ih) / 2;
|
||||||
else
|
hrest = nh - 2*nv - ih;
|
||||||
nw = (nw - iv) / 2;
|
nh = nv;
|
||||||
|
} else {
|
||||||
|
nv = (nw - iv) / 2;
|
||||||
|
wrest = nw - 2*nv - iv;
|
||||||
|
nw = nv;
|
||||||
|
}
|
||||||
|
|
||||||
if ((i % 4) == 2 && !s)
|
if ((i % 4) == 2 && !s)
|
||||||
nx += nw + iv;
|
nx += nw + iv;
|
||||||
@ -556,7 +561,10 @@ arrange_fibonacci(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n,
|
|||||||
nw = w - nw - iv;
|
nw = w - nw - iv;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
|
resize(c, nx, ny, nw + wrest - 2 * c->bw, nh + hrest - 2 * c->bw, False);
|
||||||
|
nx += wrest;
|
||||||
|
ny += hrest;
|
||||||
|
wrest = hrest = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user