[client] wayland: improve fractional scaling

avoids the 24.8 quantisation without introducing floating-point
equality/rounding behaviour throughout the Wayland state.

Closes #1257
This commit is contained in:
Geoffrey McRae
2026-05-31 13:15:42 +10:00
parent dba2d23eb2
commit 01b8724cfe
6 changed files with 103 additions and 21 deletions

View File

@@ -92,8 +92,8 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
int width, height;
wlWm.desktop->getSize(&width, &height);
wl_egl_window_resize(wlWm.eglWindow, wl_fixed_to_int(width * wlWm.scale),
wl_fixed_to_int(height * wlWm.scale), 0, 0);
wl_egl_window_resize(wlWm.eglWindow, waylandScaleMulInt(wlWm.scale, width),
waylandScaleMulInt(wlWm.scale, height), 0, 0);
if (width == 0 || height == 0)
skipResize = true;
@@ -123,7 +123,7 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
wp_viewport_destroy(wlWm.viewport);
wlWm.viewport = NULL;
}
wl_surface_set_buffer_scale(wlWm.surface, wl_fixed_to_int(wlWm.scale));
wl_surface_set_buffer_scale(wlWm.surface, waylandScaleFloor(wlWm.scale));
}
struct wl_region * region = wl_compositor_create_region(wlWm.compositor);
@@ -131,7 +131,7 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
wl_surface_set_opaque_region(wlWm.surface, region);
wl_region_destroy(region);
app_handleResizeEvent(width, height, wl_fixed_to_double(wlWm.scale),
app_handleResizeEvent(width, height, waylandScaleToDouble(wlWm.scale),
(struct Border) {0, 0, 0, 0});
app_invalidateWindow(true);
waylandStopWaitFrame();