Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop dispatching onFocus when debugger is not visible #3271

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

ACrazyTown
Copy link
Contributor

This PR solves an issue where closing the debugger would dispatch an onFocus event.

One of the issues caused by this issue is sounds playing after the debugger gets closed.
If you play a sound, pause it, open the debugger and then close it, the sound will get unpaused and continue playing.

This code seems to have been added for a reason but I can't reproduce what the comment is saying. setting FlxG.stage.focus = null; doesn't seem to dispatch any focus events. Maybe its an old OpenFL version thing? Or target specific?

@Geokureli Geokureli added this to the 5.9.0 milestone Nov 1, 2024
@Geokureli
Copy link
Member

Can you clarify the repro steps? I need to play a sound, pause the sound, then press "~" twice and the sound will resume?

@ACrazyTown
Copy link
Contributor Author

Can you clarify the repro steps? I need to play a sound, pause the sound, then press "~" twice and the sound will resume?

Yup! Play and pause the sound, open the debugger and close it. It'll dispatch a onFocus event which will then call this:

FlxG.sound.onFocus();

which will cause paused sounds to unpause and continue playing.

2024-11-03.19-54-38.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants