rust-windowing / rust-windowing/winit
Add event for changes to the safe area
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
https://github.com/rust-windowing/winit/pull/3890 added an API to query the safe area, but left an API for listening to changes to that value unspecified (only noting that RedrawRequested would be called if it changed).
The API could look something like this:
enum WindowEvent {
SafeAreaChanged {
origin: PhysicalPosition<u32>,
size: PhysicalSize<u32>,
}
// ...
}
But that'd mean we have to emit it whenever the surface resizes too, which isn't so nice.
Perhaps something like the following would be better?
struct Insets {
top: PhysicalUnit<u32>,
left: PhysicalUnit<u32>,
bottom: PhysicalUnit<u32>,
right: PhysicalUnit<u32>,
}
enum WindowEvent {
SafeAreaChanged(Insets),
// ...
}
trait Window {
fn safe_area_insets(&self) -> Insets;
// ...
}
See also discussion starting from https://github.com/rust-windowing/winit/pull/3890#issuecomment-2343351828.
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 PR 3890 and the discussion linked from its issue comment to understand the existing safe-area API and the unresolved event design. Review the WindowEvent and Window API context shown in this issue, then establish a consensus on the event shape and resize behavior. Done means the API and when it is emitted are specified and implemented consistently.
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
- Needs clarification
- Newbie friendliness
- 30/100