SDL: wayland: Scale accelerated relative pointer coordinates with emulated resolutions (d8837)

From d8837edfa2a00e8db05676ee6cea1b1c29acf5e4 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 22 Mar 2025 14:35:39 -0400
Subject: [PATCH] wayland: Scale accelerated relative pointer coordinates with
 emulated resolutions

The accelerated relative coordinates are always relative to the desktop resolution, and need to be scaled with emulated fullscreen resolutions for mouse movement to remain stable. Otherwise, pointer speeds will be too fast on emulated resolutions below the desktop resolution, and too slow on those above.

(cherry picked from commit 027df89ed367cf2a4f4b390bc933b3bd8e8471d5)
---
 src/video/wayland/SDL_waylandevents.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 7a715dbb4280d..1052d1feaa13f 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -1023,8 +1023,8 @@ static void relative_pointer_handle_relative_motion(void *data,
             dx = wl_fixed_to_double(dx_unaccel_w);
             dy = wl_fixed_to_double(dy_unaccel_w);
         } else {
-            dx = wl_fixed_to_double(dx_w);
-            dy = wl_fixed_to_double(dy_w);
+            dx = wl_fixed_to_double(dx_w) * window->pointer_scale.x;
+            dy = wl_fixed_to_double(dy_w) * window->pointer_scale.y;
         }
 
         SDL_SendMouseMotion(timestamp, window->sdlwindow, input->pointer_id, true, (float)dx, (float)dy);