diff options
author | Pedro CĂ´rte-Real <pedro@pedrocr.net> | 2019-07-28 11:29:48 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-01-01 10:14:29 -0700 |
commit | bd1fb76e0f47b2320acd6492995c9545e37c4bb8 (patch) | |
tree | 9eb6c097a77c3ddb78632020f67cb4438fc7e5b7 /sway | |
parent | 800834476200298535f4ac1be8abe58fc501cb04 (diff) | |
download | sway-bd1fb76e0f47b2320acd6492995c9545e37c4bb8.tar.xz |
Make sure we don't calculate fractional pixel gaps
When gaps are resized for lack of space the calculation could result in
a gap size of non-integer pixels. This would result in containers
located at non-integer pixels which would be subtly broken.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/tree/arrange.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index e4f59110..bac9f2fa 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -71,7 +71,7 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) { double total_gap = fmin(inner_gap * (children->length - 1), fmax(0, parent->width - MIN_SANE_W * children->length)); double child_total_width = parent->width - total_gap; - inner_gap = total_gap / (children->length - 1); + inner_gap = floor(total_gap / (children->length - 1)); // Resize windows sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent); @@ -150,7 +150,7 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) { double total_gap = fmin(inner_gap * (children->length - 1), fmax(0, parent->height - MIN_SANE_H * children->length)); double child_total_height = parent->height - total_gap; - inner_gap = total_gap / (children->length - 1); + inner_gap = floor(total_gap / (children->length - 1)); // Resize windows sway_log(SWAY_DEBUG, "Arranging %p vertically", parent); |