From e2857fc5a25582c34dd25c700ecdb0b72118d33b Mon Sep 17 00:00:00 2001
From: expikr <[EMAIL REDACTED]>
Date: Thu, 31 Oct 2024 02:00:19 +0800
Subject: [PATCH] Update SDL_mouse.c
---
include/SDL3/SDL_hints.h | 7 ++++---
src/events/SDL_mouse.c | 2 ++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h
index bf8c60401e351..f603ba715e323 100644
--- a/include/SDL3/SDL_hints.h
+++ b/include/SDL3/SDL_hints.h
@@ -2509,9 +2509,10 @@ extern "C" {
* A variable controlling whether the hardware cursor stays visible when
* relative mode is active.
*
- * This variable can be set to the following values: "0" - The cursor will be
- * hidden while relative mode is active (default) "1" - The cursor will remain
- * visible while relative mode is active
+ * This variable can be set to the following values:
+ *
+ * - "0" - The cursor will be hidden while relative mode is active (default)
+ * - "1" - The cursor will remain visible while relative mode is active
*
* Note that for systems without raw hardware inputs, relative mode is
* implemented using warping, so the hardware cursor will visibly warp between
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 6e30e9d75230f..1d9fc8a4102c1 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -200,6 +200,8 @@ static void SDLCALL SDL_MouseRelativeCursorVisibleChanged(void *userdata, const
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
mouse->relative_mode_cursor_visible = SDL_GetStringBoolean(hint, false);
+
+ SDL_SetCursor(NULL); // Update cursor visibility
}
// Public functions