SDL: wayland: Disable warp emulation when restoring cursor visibility with the shape protocol

From 67f3a3ee54b7c7e0945525408437f65f807ca8ba Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 16 May 2024 12:44:01 -0400
Subject: [PATCH] wayland: Disable warp emulation when restoring cursor
 visibility with the shape protocol

---
 src/video/wayland/SDL_waylandmouse.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index c9cdf69116615..7c54d08970ba1 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -538,7 +538,14 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
         if (!data->shmBuffer.shm_data) {
             if (input->cursor_shape) {
                 Wayland_SetSystemCursorShape(input, data->system_cursor);
+
                 input->cursor_visible = SDL_TRUE;
+
+                if (input->relative_mode_override) {
+                    Wayland_input_disable_relative_pointer(input);
+                    input->relative_mode_override = SDL_FALSE;
+                }
+
                 return 0;
             } else if (!wayland_get_system_cursor(d, data, &scale)) {
                 return -1;
@@ -607,7 +614,7 @@ static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
     } else if (input->warp_emulation_prohibited) {
         return SDL_Unsupported();
     } else if (!d->relative_mouse_mode) {
-        Wayland_input_lock_pointer(input, window);
+        Wayland_input_enable_relative_pointer(input);
         input->relative_mode_override = SDL_TRUE;
     }