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

Cross-platform inconsistency in ApplicationHandler::resumed() #3699

Closed
daxpedda opened this issue May 20, 2024 · 3 comments · Fixed by #3765
Closed

Cross-platform inconsistency in ApplicationHandler::resumed() #3699

daxpedda opened this issue May 20, 2024 · 3 comments · Fixed by #3765

Comments

@daxpedda
Copy link
Member

Currently Android requires the surface to be recreated in resumed(), but this isn't the case for Web and iOS (I think), where the surface does not need to be recreated on resumed().

I'm unsure what the solution here might be, maybe it would be best to split this into two different methods, or maybe we can tell the user somehow that the Window is invalid now.

Related: #3695.

@kchibisov
Copy link
Member

We use Occluded for stuff like that on iOS iirc, not sure about the web, but generally if you don't need to do anything you could just use Occluded as well.

Unless the state is something different than what Occluded(true) is.

@daxpedda
Copy link
Member Author

daxpedda commented May 20, 2024

No, this is not related to Occluded.
Speaking for Web: on suspended() the application will actually not be running until resumed() is fired. This is very different to Occluded, which won't stop any code from running.

@MarijnS95
Copy link
Member

@daxpedda this sounds like the original misunderstanding that "suspended" and "resumed" have anything to do with the Android lifecycle, which they also do not. This is merely supposed to be a callback on the Surface when it (dis)appears. There are separate events, that are not handled in winit currently, that signify when an app stops/starts or pauses/unpauses (more closely related to being in focus or "occluded").

If web doesn't actually need to recreate a window, resumed() is the wrong event for this. As proposed longer ago, we should perhaps provide users with such events, and rename the existing events to "surface created" and "surface removed"?

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

Successfully merging a pull request may close this issue.

3 participants