From 903301c6aaabd87f9b7cb1c03c323387d25b4eee Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 16 Nov 2022 02:04:59 -0500
Subject: [PATCH] wayland: Always use integer scaling for cursors.
Cursors don't get fractionally scaled, so always scale system cursor sizes to the next whole integer.
---
src/video/wayland/SDL_waylandmouse.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index c35457b5b581..20c5efca00ce 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -199,8 +199,10 @@ wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float
return SDL_FALSE;
}
focusdata = focus->driverdata;
- *scale = focusdata->scale_factor;
- size *= focusdata->scale_factor;
+
+ /* Cursors use integer scaling. */
+ *scale = SDL_ceilf(focusdata->scale_factor);
+ size *= *scale;
for (i = 0; i < vdata->num_cursor_themes; i += 1) {
if (vdata->cursor_themes[i].size == size) {
theme = vdata->cursor_themes[i].theme;