git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commite0bae664563e36e85b7fb1f2b25b25f85fc0420b
parent43a8906233
authorIsaac Freund <[email protected]>
date2025-12-26 21:43
OutputManager: round scale to nearest 1/120

Fractional scaling will still be wonky until position-dependent scaling
is eliminated from wlr_scene upstream.

This enhancement is simple can't hurt though.

 river/OutputManager.zig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/river/OutputManager.zig b/river/OutputManager.zig
index 556a1fb..0e6e472 100644
--- a/river/OutputManager.zig
+++ b/river/OutputManager.zig
@@ -167,7 +167,9 @@ fn handleManagerApply(_: *wl.Listener(*wlr.OutputConfigurationV1), config: *wlr.
             },
             .x = head.state.x,
             .y = head.state.y,
-            .scale = head.state.scale,
+            // Round to nearest 1/120 to ensure the scale is exactly represented
+            // in the fractional-scale-v1 protocol.
+            .scale = @round(head.state.scale * 120) / 120,
             .transform = head.state.transform,
             .adaptive_sync = head.state.adaptive_sync_enabled,
             .auto_layout = false,