diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-04-04 13:02:37 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-04-04 13:02:37 +0100 |
commit | 5a97af7961d30fc1c9debb792e85ecc89402cf49 (patch) | |
tree | 994dd79f7e5f97063188fbe4f241b7f942c6a3d8 /layout.c | |
parent | cb039b986ec2400439410a1cf983bd0a5ef4f9ca (diff) | |
parent | f4aefb738ec1444842b476f98c45068bfef6f460 (diff) | |
download | rtmux-5a97af7961d30fc1c9debb792e85ecc89402cf49.tar.gz rtmux-5a97af7961d30fc1c9debb792e85ecc89402cf49.tar.bz2 rtmux-5a97af7961d30fc1c9debb792e85ecc89402cf49.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'layout.c')
-rw-r--r-- | layout.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -722,7 +722,7 @@ layout_set_size_check(struct window *w, struct layout_cell *lc, enum layout_type type, int size) { struct layout_cell *lcchild; - u_int new_size, available, previous, count, idx; + u_int new_size, available, previous, count, idx; /* Cells with no children must just be bigger than minimum. */ if (lc->type == LAYOUT_WINDOWPANE) @@ -736,6 +736,9 @@ layout_set_size_check(struct window *w, struct layout_cell *lc, /* Check new size will work for each child. */ if (lc->type == type) { + if (available < (count * 2) - 1) + return (0); + if (type == LAYOUT_LEFTRIGHT) previous = lc->sx; else @@ -745,13 +748,17 @@ layout_set_size_check(struct window *w, struct layout_cell *lc, TAILQ_FOREACH(lcchild, &lc->cells, entry) { new_size = layout_new_pane_size(w, previous, lcchild, type, size, count - idx, available); - if (new_size > available) - return (0); - - available -= (new_size + 1); + if (idx == count - 1) { + if (new_size > available) + return (0); + available -= new_size; + } else { + if (new_size + 1 > available) + return (0); + available -= new_size + 1; + } if (!layout_set_size_check(w, lcchild, type, new_size)) return (0); - idx++; } } else { |