From ddc9b6ca21c5de1fb2b7907867152160cea33b3b Mon Sep 17 00:00:00 2001 From: MrTheShy <49885496+MrTheShy@users.noreply.github.com> Date: Fri, 6 Mar 2026 05:39:29 +0100 Subject: [PATCH] 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. --- Minecraft.Client/Windows64/KeyboardMouseInput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index fe3c39194..0086b4320 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -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);