summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-04-28 16:34:44 +0200
committerbakkeby <[email protected]>2020-04-28 16:34:44 +0200
commit8aa7a8dafb2780e5e189d54cf48fc1807f513c6d (patch)
treeba789784c66d605fa48f24036bedb9f55f3f4488 /patch
parentf7bb7f4403fb01132b2def285d58a05a874c58d5 (diff)
downloaddwm-flexipatch-8aa7a8dafb2780e5e189d54cf48fc1807f513c6d.tar.gz
dwm-flexipatch-8aa7a8dafb2780e5e189d54cf48fc1807f513c6d.zip
Changes to make gapplessgrid layout arrangement pixel perfect
Diffstat (limited to 'patch')
-rw-r--r--patch/flextile-deluxe.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/patch/flextile-deluxe.c b/patch/flextile-deluxe.c
index ce62394..d6f805b 100644
--- a/patch/flextile-deluxe.c
+++ b/patch/flextile-deluxe.c
@@ -427,7 +427,7 @@ arrange_horizgrid(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n,
static void
arrange_gapplessgrid(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai)
{
- int i, cols, rows, cn, rn, cc; // counters
+ int i, cols, rows, ch, cw, cn, rn, cc, rrest, crest; // counters
Client *c;
/* grid dimensions */
@@ -437,22 +437,31 @@ arrange_gapplessgrid(Monitor *m, int x, int y, int h, int w, int ih, int iv, int
if (an == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
cols = 2;
rows = an/cols;
- cn = rn = cc = 0; // reset cell no, row no, client count
+ cn = rn = cc = 0; // reset column no, row no, client count
+
+ ch = (h - ih * (rows - 1)) / rows;
+ rrest = (h - ih * (rows - 1)) - ch * rows;
+ cw = (w - iv * (cols - 1)) / cols;
+ crest = (w - iv * (cols - 1)) - cw * cols;
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
if (i >= ai && i < (ai + an)) {
- if (cc/rows + 1 > cols - an%cols)
+ if (cc/rows + 1 > cols - an%cols) {
rows = an/cols + 1;
+ ch = (h - ih * (rows - 1)) / rows;
+ rrest = (h - ih * (rows - 1)) - ch * rows;
+ }
resize(c,
- x + cn*((w - iv*(cols - 1)) / cols + iv),
- y + rn*((h - ih*(rows - 1)) / rows + ih),
- (w - iv*(cols - 1)) / cols,
- (h - ih*(rows - 1)) / rows,
+ x,
+ y + rn*(ch + ih) + MIN(rn, rrest),
+ cw + (cn < crest ? 1 : 0) - 2*c->bw,
+ ch + (rn < rrest ? 1 : 0) - 2*c->bw,
0);
rn++;
cc++;
if (rn >= rows) {
rn = 0;
+ x += cw + ih + (cn < crest ? 1 : 0);
cn++;
}
}