From f79d28085d07e087bf8fbbc85f94b9004db0de4b Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 16 Aug 2024 11:12:10 -0400
Subject: [PATCH] wayland: Send fake warp coordinates when emulating warps with
relative mode
Send the fake warp coordinates when emulating warps with relative mode to ensure that it appears that the cursor is always reset to where the application expects it to be.
Fixes cases where games can continue moving the camera if the mouse is lifted during motion.
(cherry picked from commit 8fcbf972c6960fb8882adfb4244e598cffacad6f)
---
src/video/wayland/SDL_waylandmouse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 18550171dcddd..278daabc3596e 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -595,6 +595,7 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y)
Wayland_input_lock_pointer(input);
input->relative_mode_override = SDL_TRUE;
}
+ SDL_SendMouseMotion(window, 0, 0, x, y);
}
}