diff options
| author | Marlian <84173858+MCbabel@users.noreply.github.com> | 2026-03-08 20:16:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-09 03:16:06 +0800 |
| commit | 8ad70cd2bef1188f81d90906dcc380a649cc346b (patch) | |
| tree | 2e8be5a984c4ea9747b7962df45507006e93cd4a /Minecraft.Client/Common | |
| parent | a14a4542c9a1d475c5bbb3f9ff6bf80be43e680a (diff) | |
Fix focus sound playing repeatedly on mouse hover (#890)
Only play eSFX_Focus when the focus control or child actually changes. Previously the sound fired on every focus event even when hovering over the same element, causing rapid sound spam over Texture Pack icons in the Create World menu.
Fixes a bug reported on Discord.
Co-authored-by: MCbabel <MCbabel@users.noreply.github.com>
Diffstat (limited to 'Minecraft.Client/Common')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index 3f204414..d01585cb 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -1331,11 +1331,17 @@ bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) void UIScene::_handleFocusChange(F64 controlId, F64 childId) { - m_iFocusControl = (int)controlId; - m_iFocusChild = (int)childId; + int newControl = (int)controlId; + int newChild = (int)childId; - handleFocusChange(controlId, childId); - ui.PlayUISFX(eSFX_Focus); + if (newControl != m_iFocusControl || newChild != m_iFocusChild) + { + m_iFocusControl = newControl; + m_iFocusChild = newChild; + + handleFocusChange(controlId, childId); + ui.PlayUISFX(eSFX_Focus); + } } void UIScene::_handleInitFocus(F64 controlId, F64 childId) |
