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.
This commit is contained in:
Dimitris Triantafyllidis 2021-02-22 13:32:07 +02:00 committed by Tudor Brindus
parent 1a6471be17
commit aac1582ea9
2 changed files with 19 additions and 19 deletions

View file

@ -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,
};