summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPeter0x44 <[email protected]>2024-03-09 10:43:29 +0000
committerGitHub <[email protected]>2024-03-09 11:43:29 +0100
commitf072497551d9f03b5fbded289f8af021c103a8c0 (patch)
treeba27f58b08a29cff54f760daa0418125fd495437
parentba066656f7be07f8f3f5e9028f053068789755a4 (diff)
downloadraylib-f072497551d9f03b5fbded289f8af021c103a8c0.tar.gz
raylib-f072497551d9f03b5fbded289f8af021c103a8c0.zip
Implement IsCursorOnScreen for PLATFORM_DESKTOP_SDL (#3862)
I did some testing and this seems to work okay, but it *is* different to GLFW. GLFW seems to lose "IsCursorOnScreen" for one frame upon pressing alt+tab over the window, without a different window covering it. SDL seems to have a more reasonable behavior for this case. Either way it's an edge case and I don't know the exact way to fix, likely requires internal GLFW changes.
-rw-r--r--src/platforms/rcore_desktop_sdl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c
index e749cecb..1aea6854 100644
--- a/src/platforms/rcore_desktop_sdl.c
+++ b/src/platforms/rcore_desktop_sdl.c
@@ -1108,11 +1108,17 @@ void PollInputEvents(void)
CORE.Window.currentFbo.height = height;
CORE.Window.resizedLastFrame = true;
} break;
+ case SDL_WINDOWEVENT_ENTER:
+ {
+ CORE.Input.Mouse.cursorOnScreen = true;
+ } break;
case SDL_WINDOWEVENT_LEAVE:
+ {
+ CORE.Input.Mouse.cursorOnScreen = false;
+ } break;
case SDL_WINDOWEVENT_HIDDEN:
case SDL_WINDOWEVENT_MINIMIZED:
case SDL_WINDOWEVENT_FOCUS_LOST:
- case SDL_WINDOWEVENT_ENTER:
case SDL_WINDOWEVENT_SHOWN:
case SDL_WINDOWEVENT_FOCUS_GAINED:
case SDL_WINDOWEVENT_MAXIMIZED: