#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).
#3890 added an API to query the safe area, but left an API for listening to changes to that value unspecified (only noting that
RedrawRequestedwould be called if it changed).The API could look something like this:
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?
See also discussion starting from #3890 (comment).