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, ¤tFocus, focusables, 64, &numFocusables); + if (currentFocus != IGGY_FOCUS_NULL) + { + IggyPlayerSetFocusRS(movie, IGGY_FOCUS_NULL, 0); + } + } } }