aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Windows64
diff options
context:
space:
mode:
authorAndrew <146450267+semiloker@users.noreply.github.com>2026-03-02 22:17:10 +0200
committerGitHub <noreply@github.com>2026-03-03 03:17:10 +0700
commitf917335b132f527c436a32f07636f503614c4e69 (patch)
tree43d86a6848187fb4d3247251389b1a339ef84a54 /Minecraft.Client/Windows64
parentbbef5445f9f0c19ac7135291a5e9ebee272aeb6a (diff)
Fix Windows64 mouse capture and static initialization crashes (#177)
Diffstat (limited to 'Minecraft.Client/Windows64')
-rw-r--r--Minecraft.Client/Windows64/Windows64_Minecraft.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
index e24bc374..7d38ff99 100644
--- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
+++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
@@ -403,6 +403,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (LOWORD(wParam) == WA_INACTIVE)
KMInput.SetCapture(false);
break;
+ case WM_SETFOCUS:
+ {
+ // Re-capture when window receives focus (e.g., after clicking on it)
+ Minecraft *pMinecraft = Minecraft::GetInstance();
+ bool shouldCapture = pMinecraft && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL;
+ if (shouldCapture)
+ KMInput.SetCapture(true);
+ }
+ break;
case WM_KILLFOCUS:
KMInput.SetCapture(false);
KMInput.ClearAllState();