Wayland: Fix rounding of fractional scale sizes

The framebuffer size for fractional scale surfaces should be rounded to
the closest integer, not truncated as is currently done.

This implements the rounding formula that the discussions over at
wayland-protocols item 132 and MR 309 appear to be converging on.

Fixes #2713
Closes #2810
This commit is contained in:
road2react
2026-01-03 20:24:53 -08:00
committed by Camilla Löwy
parent 463cf73610
commit b7ef2919b0
+3 -2
View File
@@ -478,8 +478,9 @@ static void resizeFramebuffer(_GLFWwindow* window)
{
if (window->wl.fractionalScale)
{
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator) / 120;
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator) / 120;
// Round halfway away from zero per fractional-scale-v1 protocol spec
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator + 60) / 120;
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator + 60) / 120;
}
else
{