From aac1582ea90897a25408a520b8f3bde0552a69cc Mon Sep 17 00:00:00 2001 From: Dimitris Triantafyllidis Date: Mon, 22 Feb 2021 13:32:07 +0200 Subject: Fix #5643, #5064: rounding issues in floating-point -> integer conversions Currently, various floating-point expressions involving the coordinates of borders, titlebars and content surfaces are directly assigned to integers, and so they are rounded towards zero. This results in off-by-one distances between these elements when the signs of their coordinates differ. Fixed by wrapping these expressions with a call to floor before the assignment. --- sway/desktop/output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/desktop/output.c') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 691a285d..7871a136 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -105,8 +105,8 @@ static bool get_surface_box(struct surface_iterator_data *data, data->rotation); struct wlr_box box = { - .x = data->ox + _sx, - .y = data->oy + _sy, + .x = floor(data->ox + _sx), + .y = floor(data->oy + _sy), .width = sw, .height = sh, }; -- cgit v1.2.3