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

Attach DEACTIVATE/ACTIVATE events to stage.nativeWindow. #3260

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

MAJigsaw77
Copy link
Contributor

As of the recent changes to OpenFL's NativeWindow (openfl/openfl@31e6f2e and openfl/openfl@48e150e), an issue on mobile has been fixed where DEACTIVATE and ACTIVATE events were not being called properly when user presses the power button, putting the phone into sleep mode.

This PR ensures that the events are now attached to stage.nativeWindow instead of the stage alone. The change doesn't affect other platforms (the events will continue to function as before). However, until the next OpenFL release, this fix won't take effect.

@Geokureli
Copy link
Member

Geokureli commented Sep 30, 2024

Is there a reason why the event is no longer dispatched from the stage, with this change? Or rather, why didn't the fix make it so that the event is dispatched through the stage, as expected?

@MAJigsaw77
Copy link
Contributor Author

Is there a reason why the event is no longer dispatched from the stage, with this change? Or rather, why didn't the fix make it so that the event is dispatched through the stage, as expected?

Tbh, i was confused as well but they don't wanna fix the stage to dispatch these events but instead they fixed the nativeWindow so ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯.

@Geokureli
Copy link
Member

Geokureli commented Oct 1, 2024

My specific concerns are:

  • Will this code work in both the newest and oldest allowed versions of openfl/lime and for all targets?
  • What changed and on what version?
  • Do we need to check openfl version here to determine where to listen for these events

Currently, our minimum supported openfl version is 9.2.2 and minimum lime is 8.0.2. If needed, we can raise those but it doesn't seem necessary, here

@MAJigsaw77
Copy link
Contributor Author

My specific concerns are:

  • Will this code work in both the newest and oldest allowed versions of openfl/lime and for all targets?
  • What changed and on what version?
  • Do we need to check openfl version here to determine where to listen for these events

Currently, our minimum supported openfl version is 9.2.2 and minimum lime is 8.0.2. If needed, we can raise those but it doesn't seem necessary, here

  • The code in the nativeWindow would work just like the stage's events as they are attached to the window callbacks just like the stage.
  • The changes to the nativeWindow have been made on these commits (openfl/openfl@31e6f2e and openfl/openfl@48e150e).
  • As of my latest change to this pr, the code should work just fine for the minimum required openfl version.

@Geokureli Geokureli merged commit 38d5323 into HaxeFlixel:dev Oct 1, 2024
11 checks passed
@Geokureli
Copy link
Member

Thanks, and thanks for looking into my concerns

@MAJigsaw77 MAJigsaw77 deleted the patch-1 branch October 1, 2024 16:01
@dimensionscape
Copy link

We didn't change the behavior of Stage, I just fixed an issue with NativeWindow. We may apply a similar fix to Stage if it is appropriate as well.

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

Successfully merging this pull request may close these issues.

3 participants