SDL: wayland: Scale mouse warp coordinates

From 18513d1ce85162d6031f65ef12b79ef28af2fb59 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 18 May 2024 09:52:47 -0400
Subject: [PATCH] wayland: Scale mouse warp coordinates

Fixes warp positioning with scaled windows.
---
 src/video/wayland/SDL_waylandmouse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 7c54d08970ba1..b98013b76d498 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -597,7 +597,9 @@ static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
                 Wayland_input_lock_pointer(input, window);
             }
             if (wind->locked_pointer) {
-                zwp_locked_pointer_v1_set_cursor_position_hint(wind->locked_pointer, wl_fixed_from_double(x), wl_fixed_from_double(y));
+                const wl_fixed_t f_x = wl_fixed_from_double(x / wind->pointer_scale.x);
+                const wl_fixed_t f_y = wl_fixed_from_double(y / wind->pointer_scale.y);
+                zwp_locked_pointer_v1_set_cursor_position_hint(wind->locked_pointer, f_x, f_y);
                 wl_surface_commit(wind->surface);
             }
             if (toggle_lock) {