X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=3fb090f92ade9aec81c6473d5758fe1c32ff51a1;hb=3c99b00a532db0b6276b46b91efe48033fbdbfbf;hp=6f891fe1e59a537525fe7ab1daecb6fac6b88cff;hpb=80969cf8c29a2dafad8dd7cd15b8aea39110f876;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 6f891fe..3fb090f 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -1390,9 +1390,9 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) continue; if (split && i == split) { - colno = (winno - split) / s; - if (stacks == 1) - colno += (winno - split) % s; + colno = (winno - mwin) / stacks; + if (s <= (winno - mwin) % stacks) + colno++; split = split + colno; hrh = (r_g.h / colno); extra = r_g.h - (colno * hrh); @@ -1400,7 +1400,11 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) win_g.x = r_g.x; else win_g.x += win_g.w + 2; - win_g.w = (r_g.w - (msize + 2) - (stacks * 2)) / stacks; + win_g.w = (((r_g.w - (msize + 2)) - + ((stacks - 1) * 2)) / stacks); + if (s == 1) + win_g.w += (((r_g.w - (msize + 2)) - + ((stacks - 1) * 2)) % stacks); s--; j = 0; }