Fix mouse cursor staying trapped in window on alt-tab

When the inventory or other UI with a hidden cursor was open,
alt-tabbing out would leave the cursor locked to the game window.
SetWindowFocused(false) from WM_KILLFOCUS correctly released the
clip and showed the cursor, but Tick() was unconditionally calling
SetCursorPos every frame to re-center it, overriding the release.

Added m_windowFocused to the Tick() condition so cursor manipulation
only happens while the window actually has focus.
This commit is contained in:
MrTheShy 2026-03-06 05:39:29 +01:00
parent 0989458b17
commit ddc9b6ca21

View file

@ -125,7 +125,7 @@ void KeyboardMouseInput::Tick()
}
}
if ((m_mouseGrabbed || m_cursorHiddenForUI) && g_hWnd)
if ((m_mouseGrabbed || m_cursorHiddenForUI) && m_windowFocused && g_hWnd)
{
RECT rc;
GetClientRect(g_hWnd, &rc);