mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
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.
This commit is contained in:
parent
c284ed379c
commit
9ad22109bb
|
@ -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),
|
double total_gap = fmin(inner_gap * (children->length - 1),
|
||||||
fmax(0, parent->width - MIN_SANE_W * children->length));
|
fmax(0, parent->width - MIN_SANE_W * children->length));
|
||||||
double child_total_width = parent->width - total_gap;
|
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
|
// Resize windows
|
||||||
sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent);
|
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),
|
double total_gap = fmin(inner_gap * (children->length - 1),
|
||||||
fmax(0, parent->height - MIN_SANE_H * children->length));
|
fmax(0, parent->height - MIN_SANE_H * children->length));
|
||||||
double child_total_height = parent->height - total_gap;
|
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
|
// Resize windows
|
||||||
sway_log(SWAY_DEBUG, "Arranging %p vertically", parent);
|
sway_log(SWAY_DEBUG, "Arranging %p vertically", parent);
|
||||||
|
|
Loading…
Reference in a new issue