Skip to content

Add event for changes to the safe area #3911

@madsmtm

Description

@madsmtm

#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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions