From 510c7edd9b53c6e1b826a2a009de24fcc4dfb2c1 Mon Sep 17 00:00:00 2001
From: expikr <[EMAIL REDACTED]>
Date: Mon, 28 Apr 2025 11:41:10 +0800
Subject: [PATCH] migrate usage of SetCursor(NULL) to RedrawCursor()
---
src/events/SDL_mouse.c | 12 ++++++------
src/video/riscos/SDL_riscosmodes.c | 2 +-
src/video/wayland/SDL_waylandmouse.c | 4 ++--
src/video/x11/SDL_x11mouse.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 80d9439e39863..e2e9e4abc64d9 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -231,7 +231,7 @@ static void SDLCALL SDL_MouseRelativeCursorVisibleChanged(void *userdata, const
mouse->relative_mode_hide_cursor = !(SDL_GetStringBoolean(hint, false));
- SDL_SetCursor(NULL); // Update cursor visibility
+ SDL_RedrawCursor(); // Update cursor visibility
}
static void SDLCALL SDL_MouseIntegerModeChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
@@ -606,7 +606,7 @@ void SDL_SetMouseFocus(SDL_Window *window)
}
// Update cursor visibility
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
bool SDL_MousePositionInWindow(SDL_Window *window, float x, float y)
@@ -1360,7 +1360,7 @@ bool SDL_SetRelativeMouseMode(bool enabled)
if (enabled) {
// Update cursor visibility before we potentially warp the mouse
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
if (enabled && focusWindow) {
@@ -1380,7 +1380,7 @@ bool SDL_SetRelativeMouseMode(bool enabled)
if (!enabled) {
// Update cursor visibility after we restore the mouse position
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
// Flush pending mouse motion - ideally we would pump events, but that's not always safe
@@ -1720,7 +1720,7 @@ bool SDL_ShowCursor(void)
if (!mouse->cursor_visible) {
mouse->cursor_visible = true;
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
return true;
}
@@ -1731,7 +1731,7 @@ bool SDL_HideCursor(void)
if (mouse->cursor_visible) {
mouse->cursor_visible = false;
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
return true;
}
diff --git a/src/video/riscos/SDL_riscosmodes.c b/src/video/riscos/SDL_riscosmodes.c
index d4e9a5345b8d6..05da04634e429 100644
--- a/src/video/riscos/SDL_riscosmodes.c
+++ b/src/video/riscos/SDL_riscosmodes.c
@@ -302,7 +302,7 @@ bool RISCOS_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SD
}
// Update cursor visibility, since it may have been disabled by the mode change.
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
return true;
}
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index b7662e479892e..59f91b6b9f854 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -196,7 +196,7 @@ static DBusHandlerResult Wayland_DBusCursorMessageFilter(DBusConnection *conn, D
if (dbus_cursor_size != new_cursor_size) {
dbus_cursor_size = new_cursor_size;
- SDL_SetCursor(NULL); // Force cursor update
+ SDL_RedrawCursor(); // Force cursor update
}
} else if (SDL_strcmp(CURSOR_THEME_KEY, key) == 0) {
const char *new_cursor_theme = NULL;
@@ -223,7 +223,7 @@ static DBusHandlerResult Wayland_DBusCursorMessageFilter(DBusConnection *conn, D
// Purge the current cached themes and force a cursor refresh.
Wayland_FreeCursorThemes(vdata);
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
}
} else {
goto not_our_signal;
diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c
index 343d8654457b6..6cfe1c0501997 100644
--- a/src/video/x11/SDL_x11mouse.c
+++ b/src/video/x11/SDL_x11mouse.c
@@ -552,7 +552,7 @@ void X11_QuitMouse(SDL_VideoDevice *_this)
void X11_SetHitTestCursor(SDL_HitTestResult rc)
{
if (rc == SDL_HITTEST_NORMAL || rc == SDL_HITTEST_DRAGGABLE) {
- SDL_SetCursor(NULL);
+ SDL_RedrawCursor();
} else {
X11_ShowCursor(sys_cursors[rc]);
}