Add WindowEvent::SafeAreaChanged event#4507
Add WindowEvent::SafeAreaChanged event#4507nicoburns wants to merge 2 commits intorust-windowing:masterfrom
WindowEvent::SafeAreaChanged event#4507Conversation
Signed-off-by: Nico Burns <nico@nicoburns.com>
|
@madsmtm I wasn't sure how to listen for changes on macOS (what does the safe area even correspond to on macOS?). Do you know how to do that? |
64afeeb to
a6d2056
Compare
Signed-off-by: Nico Burns <nico@nicoburns.com>
a6d2056 to
1769904
Compare
|
The safe area on macOS is the notch in fullscreen applications, and when you use |
| /// [`Window::safe_area`]). | ||
| /// | ||
| /// This event will not necessarily be emitted upon window creation, query | ||
| /// [`Window::safe_area`] if you need to determine the initial safe area. |
There was a problem hiding this comment.
Should discuss the relationship with SurfaceResized (and specifically that either may be emitted independently).
Unless we don't want that, and think it makes sense to also emit a SurfaceResized? But if so, what is the point of SafeAreaChanged?
There was a problem hiding this comment.
Yes, probably. I guess if you get SurfaceResized, then you probably need to re-resolve the safe area (as it's insets relative to the surface size), but the other way round is not true. You can process the safe area events assuming that the surface size is unchanged.
| @@ -127,6 +127,15 @@ define_class!( | |||
| debug!("safeAreaInsetsDidChange was called, requesting redraw"); | |||
| // When the safe area changes we want to make sure to emit a redraw event | |||
| self.setNeedsDisplay(); | |||
There was a problem hiding this comment.
Should be updated depending on what we decide the semantics should be.
Implements a
SafeAreaChangedevent on Android and iOS. Currently a draft because not yet tested.Window::safe_area#4506changelogmodule if knowledge of this change could be valuable to users