-
Notifications
You must be signed in to change notification settings - Fork 757
Safe Area #9757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Safe Area #9757
Conversation
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct LogicalInset { | ||
/// The top inset in logical pixels. | ||
pub top: f32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use LogicalLength here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because LogicalLength is an euclid type, and we don't want to be tied to euclid in the public API (according to Simon).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, very good reason.
/// of the border between the safe area and the edges of the window. | ||
#[derive(Debug, Default, Copy, Clone, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct LogicalInset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the struct to the slint::LogicalInset
public API? Right now, struct from this module are re-exported. I'm thinking we should try to limit the public API surface.
Since this is only used in the event, I'm thinking it could have top
, bottom
, ... fields instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it because returning the inset in safe_area_inset
as a tuple of four lengths would be highly confusing (in which order would the lengths be?).
|
||
/// Return the inset of the safe area of the Window in physical pixels. | ||
/// This is necessary to avoid overlapping system UI such as notches or system bars. | ||
fn safe_area_inset(&self) -> PhysicalInset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we do not need this function and have the platform send the SafeAreaChanged
event instead. Would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The safe area is required to be read twice when no event occurs, in WindowInner::show
and WindowInner::set_component
. This is actually the main way to get the safe area, I don't think that it changes during the runtime of the application.
…ng the safe area to Slint. Also includes the iOS implementation for this.
…S implementation. This is a breaking change!
12902fc
to
3393fe0
Compare
Fixes #9755
Fixes #xxx
orCloses #xxx
ChangeLog: ...