Emit destroy_surfaces() consistently on all platforms
#4419
+57
−13
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.
Fixes #3206
Surface creation and destruction events exist "specifically" for Android which has diverging lifetimes for its
Surfacestructure compared to other platforms; specifically VulkanVkSurfaceKHRorEGLSurfaceobjects need to be destroyed and recreated.Commit 6cdb317 ("Consistently deliver a Resumed event on all platforms") made sure to consistently call
can_create_surfaces()(Event::Resumedback then) on all platforms directly after startup so that users don't have to have platform-specific surface creation behaviour in two disjoint places, but we forgot aboutdestroy_surfaces()(back thenEvent::Suspended) leading to applications still having to handle this destruction in two different places.Solve that by calling the callback on all those platforms, directly before returning
PumpStatus::Exitfromfn single_iteration().Important
Draft because this is entirely untested and may not even compile on all platforms. The samples likely still need to be updated to match the new behaviour too.
In a distant future (before Winit 0.31 perhaps) these events should perhaps be moved to
WindowEvent.