rust-windowing / rust-windowing/winit
Emit `destroy_surfaces()` on every platform before `LoopDestroyed` for surface-cleanup feature parity?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
As we have done in #2331 by emitting Resumed on every platform somewhere after the loop starts (for platforms that don't have an explicit point/callback where this should happen) to consistently implement surface creation, we should likely do the same with Suspended on loop shutdown for platforms that don't have an explicit callback here. This will allow implementers to perform surface destruction in a single consistent place too.
I'm currently improving a random winit sample to utilize these events, and the implementation becomes clumsy when having surface destruction in both LoopExiting and Suspended. It might even conflict with WindowEvent::Destroyed.
On Android I'm not yet sure if triggering a loop exit would terminate the Android app in such a way that surface destruction (== Suspended) is raised prior to LoopExiting anyway.
Side-note: Android supports multiple windows, and once the backend crates handle that properly perhaps Resumed needs to be moved to a WindowEvent, and Suspended will become Destroyed?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the event-loop shutdown paths for each platform backend and the precedent in issue #2331. Check how Android handles loop exit and whether Suspended, LoopExiting, and WindowEvent::Destroyed can be ordered consistently. Done means surface destruction has one consistent event before LoopDestroyed, with the platform behavior and multi-window implications resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop-dev, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100