aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI
diff options
context:
space:
mode:
authorLrxh <seabearvalorant@gmail.com>2026-03-07 01:39:55 +0100
committerGitHub <noreply@github.com>2026-03-06 18:39:55 -0600
commit2f614a52c2afea79733379ce1a7595f5188a9158 (patch)
tree6e0ea05c36bd4239869082c8b1bdee193c8d014f /Minecraft.Client/Common/UI
parent55be6447e33e27cc8820b3fa7d6a8decd147cd2e (diff)
Fix UI button staying focused on mouse-out + controller snap (#773)
Diffstat (limited to 'Minecraft.Client/Common/UI')
-rw-r--r--Minecraft.Client/Common/UI/UIController.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp
index 840ed389..374e2c4d 100644
--- a/Minecraft.Client/Common/UI/UIController.cpp
+++ b/Minecraft.Client/Common/UI/UIController.cpp
@@ -865,6 +865,7 @@ void UIController::tickInput()
int hitControlId = -1;
S32 hitArea = INT_MAX;
UIControl *hitCtrl = NULL;
+ bool hitAny = false;
for (size_t i = 0; i < controls->size(); ++i)
{
UIControl *ctrl = (*controls)[i];
@@ -906,7 +907,8 @@ void UIController::tickInput()
hitControlId = -1;
hitArea = INT_MAX;
hitCtrl = NULL;
- break; // ButtonList takes priority
+ hitAny = true;
+ break; // ButtonList takes priority
}
if (type == UIControl::eTexturePackList)
{
@@ -919,6 +921,7 @@ void UIController::tickInput()
hitControlId = -1;
hitArea = INT_MAX;
hitCtrl = NULL;
+ hitAny = true;
break;
}
S32 area = cw * ch;
@@ -927,6 +930,7 @@ void UIController::tickInput()
hitControlId = ctrl->getId();
hitArea = area;
hitCtrl = ctrl;
+ hitAny = true;
if (type == UIControl::eSlider)
m_bMouseHoverHorizontalList = true;
}
@@ -954,6 +958,19 @@ void UIController::tickInput()
}
}
}
+ else if (!hitAny && !pScene->isDirectEditBlocking())
+ {
+ // Mouse moved away from all controls — clear focus if set
+ Iggy *movie = pScene->getMovie();
+ IggyFocusHandle currentFocus = IGGY_FOCUS_NULL;
+ IggyFocusableObject focusables[64];
+ S32 numFocusables = 0;
+ IggyPlayerGetFocusableObjects(movie, &currentFocus, focusables, 64, &numFocusables);
+ if (currentFocus != IGGY_FOCUS_NULL)
+ {
+ IggyPlayerSetFocusRS(movie, IGGY_FOCUS_NULL, 0);
+ }
+ }
}
}