From c8edf1eaf3ef69eeca1e1c2d645e3da8d0ea90bf Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 3 Jun 2026 20:44:16 -0400 Subject: [PATCH] [client] wayland: use round half away from zero behaviour In fractional-scale-v1, the scaling is defined as follows: > For toplevel surfaces, the size is rounded halfway away from zero. Previously, it is undefined. This commit makes waylandScaleMulInt follow the round half away from zero behaviour. --- client/displayservers/Wayland/scale.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/displayservers/Wayland/scale.h b/client/displayservers/Wayland/scale.h index 79f4adba..c3224036 100644 --- a/client/displayservers/Wayland/scale.h +++ b/client/displayservers/Wayland/scale.h @@ -71,7 +71,7 @@ static inline int waylandScaleCeil(struct WaylandScale scale) static inline int waylandScaleMulInt(struct WaylandScale scale, int value) { - return (int)(((int64_t)value * scale.num) / scale.den); + return (int)(((int64_t)value * scale.num + scale.den / 2) / scale.den); } static inline double waylandScaleToDouble(struct WaylandScale scale)