Fix focus sound playing repeatedly on mouse hover#890
Open
MCbabel wants to merge 1 commit intosmartcmd:mainfrom
Open
Fix focus sound playing repeatedly on mouse hover#890MCbabel wants to merge 1 commit intosmartcmd:mainfrom
MCbabel wants to merge 1 commit intosmartcmd:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the hover sound spamming rapidly when moving the mouse over the Texture Pack selector in the Create World menu. Reported on Discord.
Changes
Previous Behavior
The focus sound (
eSFX_Focus) played on every focus event from IggyPlayer, even when the focus didn't actually change. Moving the mouse over the Texture Pack icons triggered dozens of focus events per second, causing a loud buzzing sound.Root Cause
UIScene::_handleFocusChange()unconditionally played the sound without checking ifcontrolId/childIdactually differed from the current focus.New Behavior
Sound only plays when the focus target actually changes. Hovering over the same element does not repeat the sound.
Fix Implementation
Added a check in
_handleFocusChange()that compares the newcontrolId/childIdagainst the storedm_iFocusControl/m_iFocusChild. Only updates and plays the sound if they differ.Related Issues