migrate usage of SetCursor(NULL) to RedrawCursor()

This commit is contained in:
expikr
2025-04-28 11:41:10 +08:00
committed by Sam Lantinga
parent 4779499048
commit 510c7edd9b
4 changed files with 10 additions and 10 deletions

View File

@@ -231,7 +231,7 @@ static void SDLCALL SDL_MouseRelativeCursorVisibleChanged(void *userdata, const
mouse->relative_mode_hide_cursor = !(SDL_GetStringBoolean(hint, false)); 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) 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 // Update cursor visibility
SDL_SetCursor(NULL); SDL_RedrawCursor();
} }
bool SDL_MousePositionInWindow(SDL_Window *window, float x, float y) bool SDL_MousePositionInWindow(SDL_Window *window, float x, float y)
@@ -1360,7 +1360,7 @@ bool SDL_SetRelativeMouseMode(bool enabled)
if (enabled) { if (enabled) {
// Update cursor visibility before we potentially warp the mouse // Update cursor visibility before we potentially warp the mouse
SDL_SetCursor(NULL); SDL_RedrawCursor();
} }
if (enabled && focusWindow) { if (enabled && focusWindow) {
@@ -1380,7 +1380,7 @@ bool SDL_SetRelativeMouseMode(bool enabled)
if (!enabled) { if (!enabled) {
// Update cursor visibility after we restore the mouse position // 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 // 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) { if (!mouse->cursor_visible) {
mouse->cursor_visible = true; mouse->cursor_visible = true;
SDL_SetCursor(NULL); SDL_RedrawCursor();
} }
return true; return true;
} }
@@ -1731,7 +1731,7 @@ bool SDL_HideCursor(void)
if (mouse->cursor_visible) { if (mouse->cursor_visible) {
mouse->cursor_visible = false; mouse->cursor_visible = false;
SDL_SetCursor(NULL); SDL_RedrawCursor();
} }
return true; return true;
} }

View File

@@ -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. // Update cursor visibility, since it may have been disabled by the mode change.
SDL_SetCursor(NULL); SDL_RedrawCursor();
return true; return true;
} }

View File

@@ -196,7 +196,7 @@ static DBusHandlerResult Wayland_DBusCursorMessageFilter(DBusConnection *conn, D
if (dbus_cursor_size != new_cursor_size) { if (dbus_cursor_size != new_cursor_size) {
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) { } else if (SDL_strcmp(CURSOR_THEME_KEY, key) == 0) {
const char *new_cursor_theme = NULL; 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. // Purge the current cached themes and force a cursor refresh.
Wayland_FreeCursorThemes(vdata); Wayland_FreeCursorThemes(vdata);
SDL_SetCursor(NULL); SDL_RedrawCursor();
} }
} else { } else {
goto not_our_signal; goto not_our_signal;

View File

@@ -552,7 +552,7 @@ void X11_QuitMouse(SDL_VideoDevice *_this)
void X11_SetHitTestCursor(SDL_HitTestResult rc) void X11_SetHitTestCursor(SDL_HitTestResult rc)
{ {
if (rc == SDL_HITTEST_NORMAL || rc == SDL_HITTEST_DRAGGABLE) { if (rc == SDL_HITTEST_NORMAL || rc == SDL_HITTEST_DRAGGABLE) {
SDL_SetCursor(NULL); SDL_RedrawCursor();
} else { } else {
X11_ShowCursor(sys_cursors[rc]); X11_ShowCursor(sys_cursors[rc]);
} }