From d553372682469780d4e5428ca8ddee0dfc3717e3 Mon Sep 17 00:00:00 2001 From: expikr <77922942+expikr@users.noreply.github.com> Date: Sun, 27 Apr 2025 13:48:26 +0800 Subject: [PATCH] rename cursor_shown to cursor_visible --- src/events/SDL_mouse.c | 18 +++++++++--------- src/events/SDL_mouse_c.h | 2 +- src/video/cocoa/SDL_cocoawindow.m | 2 +- src/video/kmsdrm/SDL_kmsdrmmouse.c | 2 +- src/video/wayland/SDL_waylandmouse.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 44f4f23992..65ddeee0bd 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -304,7 +304,7 @@ bool SDL_PreInitMouse(void) mouse->was_touch_mouse_events = false; // no touch to mouse movement event pending - mouse->cursor_shown = true; + mouse->cursor_visible = true; return true; } @@ -812,7 +812,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL } // Move the mouse cursor, if needed - if (mouse->cursor_shown && !mouse->relative_mode && + if (mouse->cursor_visible && !mouse->relative_mode && mouse->MoveCursor && mouse->cur_cursor) { mouse->MoveCursor(mouse->cur_cursor); } @@ -1289,7 +1289,7 @@ static void SDL_MaybeEnableWarpEmulation(SDL_Window *window, float x, float y) { SDL_Mouse *mouse = SDL_GetMouse(); - if (!mouse->warp_emulation_prohibited && mouse->warp_emulation_hint && !mouse->cursor_shown && !mouse->warp_emulation_active) { + if (!mouse->warp_emulation_prohibited && mouse->warp_emulation_hint && !mouse->cursor_visible && !mouse->warp_emulation_active) { if (!window) { window = mouse->focus; } @@ -1635,7 +1635,7 @@ bool SDL_SetCursor(SDL_Cursor *cursor) } } - if (cursor && (!mouse->focus || (mouse->cursor_shown && (!mouse->relative_mode || mouse->relative_mode_cursor_visible)))) { + if (cursor && (!mouse->focus || (mouse->cursor_visible && (!mouse->relative_mode || mouse->relative_mode_cursor_visible)))) { if (mouse->ShowCursor) { mouse->ShowCursor(cursor); } @@ -1711,8 +1711,8 @@ bool SDL_ShowCursor(void) mouse->warp_emulation_active = false; } - if (!mouse->cursor_shown) { - mouse->cursor_shown = true; + if (!mouse->cursor_visible) { + mouse->cursor_visible = true; SDL_SetCursor(NULL); } return true; @@ -1722,8 +1722,8 @@ bool SDL_HideCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse->cursor_shown) { - mouse->cursor_shown = false; + if (mouse->cursor_visible) { + mouse->cursor_visible = false; SDL_SetCursor(NULL); } return true; @@ -1733,5 +1733,5 @@ bool SDL_CursorVisible(void) { SDL_Mouse *mouse = SDL_GetMouse(); - return mouse->cursor_shown; + return mouse->cursor_visible; } diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index bfda17beaa..9162e250fe 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -148,7 +148,7 @@ typedef struct SDL_Cursor *cursors; SDL_Cursor *def_cursor; SDL_Cursor *cur_cursor; - bool cursor_shown; + bool cursor_visible; // Driver-dependent data. void *internal; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 3e9642a3c0..7201c0e692 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -743,7 +743,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { + if (mouse->cursor_visible && mouse->cur_cursor && !mouse->relative_mode) { return (__bridge NSCursor *)mouse->cur_cursor->internal; } diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c index bb50ae3985..383d7d43a7 100644 --- a/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -50,7 +50,7 @@ static void KMSDRM_FreeCursor(SDL_Cursor *cursor); // KMSDRM_ShowCursor() simply shows or hides the cursor it receives: it does NOT // mind if it's mouse->cur_cursor, etc. // -If KMSDRM_ShowCursor() returns successfully, that cursor becomes -// mouse->cur_cursor and mouse->cursor_shown is 1. +// mouse->cur_cursor and mouse->cursor_visible is 1. /**************************************************************************************/ static SDL_Cursor *KMSDRM_CreateDefaultCursor(void) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 956087fdd8..e5e2502a95 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -1025,7 +1025,7 @@ void Wayland_RecreateCursors(void) } if (mouse->cur_cursor) { Wayland_RecreateCursor(mouse->cur_cursor, vdata); - if (mouse->cursor_shown) { + if (mouse->cursor_visible) { Wayland_ShowCursor(mouse->cur_cursor); } }