-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add event for changes to the safe area #3911
Copy link
Copy link
Open
Labels
C - needs discussionDirection must be ironed outDirection must be ironed outS - apiDesign and usabilityDesign and usability
Description
#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 #3890 (comment).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C - needs discussionDirection must be ironed outDirection must be ironed outS - apiDesign and usabilityDesign and usability