From aa59eae8c8a9ecb0130a4f1ac1830ce854cd173b Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sat, 7 Dec 2024 20:58:12 +0000 Subject: [PATCH] window: fix hiding mouse cursor when regaining focus in windowed mode --- UnleashedRecomp/ui/window.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/ui/window.cpp b/UnleashedRecomp/ui/window.cpp index 7cc4296..68ebab6 100644 --- a/UnleashedRecomp/ui/window.cpp +++ b/UnleashedRecomp/ui/window.cpp @@ -84,9 +84,14 @@ int Window_OnSDLEvent(void*, SDL_Event* event) break; case SDL_WINDOWEVENT_FOCUS_GAINED: + { Window::s_isFocused = true; - SDL_ShowCursor(Window::IsFullscreen() && Window::s_isFullscreenCursorVisible ? SDL_ENABLE : SDL_DISABLE); + + if (Window::IsFullscreen()) + SDL_ShowCursor(Window::s_isFullscreenCursorVisible ? SDL_ENABLE : SDL_DISABLE); + break; + } case SDL_WINDOWEVENT_RESTORED: Config::WindowState = EWindowState::Normal;