rust-windowing / rust-windowing/winit
Possible solution to keep created surface consistent
Open
Nobody has claimed this yet.
DS - android
S - enhancement
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Description
Motivation
This issue aims for the following topics:
- Users have to self-reference the window handle to the surface, which can be hard to implement.
- The created surfaces must be dropped by user when the the app was suspended, and we may somehow "enforce" it.
- Owning the optional window and surface in every update can have lifetime issues, and we may make some platform-specific changes to make it "consistent" to user.
- The "optional" surface problem seemed to be only present in Android.
I am unsure about whether winit should absolutely do some changes for them, but this issue is opened for the discusssions about the possible solutions and winit api design.
Proposed Change
- Require the user to implement a "bridge" type, which owns the corresponding surface, and gets dropped and recreated by winit when being suspended in Android.
- Make the "bridge" type or ApplicationHandler trait include the window recreation logic, so winit can recreate the window and own it, which assured the users to have a "window" in every update.
Relevant platforms
Android
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 with the issue's Android-specific discussion of surface and window lifetimes, then compare the proposed bridge type with the ApplicationHandler recreation logic. Review how suspension affects ownership and recreation, and define what API direction would provide consistent windows and surfaces before implementation begins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, rust
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100