From 7ff958e124061d5d2079f021ef1c96904597885b Mon Sep 17 00:00:00 2001 From: MrTheShy <49885496+MrTheShy@users.noreply.github.com> Date: Thu, 5 Mar 2026 21:17:53 +0100 Subject: [PATCH] Use last active input device to decide keyboard mode instead of connection state The keyboard UI mode (on-screen virtual keyboard vs direct text input) was determined by Win64_IsControllerConnected(), which checks if any XInput controller is physically plugged in. This meant that even if the player was actively using mouse and keyboard, the virtual keyboard would still appear as long as a controller was connected. Replace the connection check with g_KBMInput.IsKBMActive(), which tracks the actual last-used input device based on per-frame input detection. Now the keyboard mode is determined by what the player is currently using, not what hardware happens to be plugged in. Affected scenes: CreateWorldMenu (world naming) and LoadOrJoinMenu (world renaming). --- Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp | 4 ++-- Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 2bd06bc63..6afb67e49 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -476,7 +476,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { m_bIgnoreInput=true; #ifdef _WINDOWS64 - if (Win64_IsControllerConnected()) + if (!g_KBMInput.IsKBMActive()) { UIKeyboardInitData kbData; kbData.title = app.GetString(IDS_CREATE_NEW_WORLD); @@ -488,7 +488,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) } else { - // PC without controller: edit the name field directly in-place. + // PC with KBM active: edit the name field directly in-place. m_bIgnoreInput = false; // Don't block input - m_bDirectEditing is the guard m_worldNameBeforeEdit = m_worldName; m_bDirectEditing = true; diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index 8664aca12..20afa4f12 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -2394,7 +2394,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS kbData.maxChars = 25; kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback; kbData.lpParam = pClass; - kbData.pcMode = !Win64_IsControllerConnected(); + kbData.pcMode = g_KBMInput.IsKBMActive(); ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); } #elif defined _DURANGO