pub trait DecorationsFrame: Sized {
Show 16 methods // Required methods fn on_click( &mut self, timestamp: Duration, click: FrameClick, pressed: bool ) -> Option<FrameAction>; fn click_point_moved( &mut self, timestamp: Duration, surface_id: &ObjectId, x: f64, y: f64 ) -> Option<CursorIcon>; fn click_point_left(&mut self); fn update_state(&mut self, state: WindowState); fn update_wm_capabilities( &mut self, wm_capabilities: WindowManagerCapabilities ); fn resize(&mut self, width: NonZeroU32, height: NonZeroU32); fn set_scaling_factor(&mut self, scale_factor: f64); fn location(&self) -> (i32, i32); fn subtract_borders( &self, width: NonZeroU32, height: NonZeroU32 ) -> (Option<NonZeroU32>, Option<NonZeroU32>); fn add_borders(&self, width: u32, height: u32) -> (u32, u32); fn is_dirty(&self) -> bool; fn set_hidden(&mut self, hidden: bool); fn is_hidden(&self) -> bool; fn set_resizable(&mut self, resizable: bool); fn draw(&mut self) -> bool; fn set_title(&mut self, title: impl Into<String>);
}
Expand description

The interface for the client side decorations.

Required Methods§

source

fn on_click( &mut self, timestamp: Duration, click: FrameClick, pressed: bool ) -> Option<FrameAction>

Emulate click on the decorations.

The click is a variant of click to use, see FrameClick for more information. timestamp is the time when event happened.

The return value is a FrameAction you should apply, this action could be ignored.

The location of the click is the one passed to Self::click_point_moved.

source

fn click_point_moved( &mut self, timestamp: Duration, surface_id: &ObjectId, x: f64, y: f64 ) -> Option<CursorIcon>

Emulate pointer moved event on the decorations frame.

The x and y are location in the surface local coordinates relative to the surface. timestamp is the time when event happened.

The return value is the new cursor icon you should apply to provide better visual feedback for the user. However, you might want to ignore it, if you’re using touch events to drive the movements.

source

fn click_point_left(&mut self)

All clicks left the decorations.

This function should be called when input leaves the decorations.

source

fn update_state(&mut self, state: WindowState)

Update the state of the frame.

The state is usually obtained from the xdg_toplevel::configure event.

source

fn update_wm_capabilities(&mut self, wm_capabilities: WindowManagerCapabilities)

Update the window manager capabilites.

The capabilites are usually obtained from the xdg_toplevel::wm_capabilities event.

source

fn resize(&mut self, width: NonZeroU32, height: NonZeroU32)

Resize the window to the new size.

The size must be without the borders, as in [Self::subtract_borders] were used on it.

Note: The Self::update_state and Self::update_wm_capabilities must be applied before calling this function.

Panics

Panics when resizing the hidden frame.

source

fn set_scaling_factor(&mut self, scale_factor: f64)

Set the scaling of the decorations frame.

If the decorations frame is not supporting fractional scaling it’ll ceil the scaling factor.

source

fn location(&self) -> (i32, i32)

Return the coordinates of the top-left corner of the borders relative to the content.

Values must thus be non-positive.

source

fn subtract_borders( &self, width: NonZeroU32, height: NonZeroU32 ) -> (Option<NonZeroU32>, Option<NonZeroU32>)

Subtract the borders from the given width and height.

None will be returned for the particular dimension when the given value for it was too small.

source

fn add_borders(&self, width: u32, height: u32) -> (u32, u32)

Add the borders to the given width and height.

Passing zero for both width and height could be used to get the size of the decorations frame.

source

fn is_dirty(&self) -> bool

Whether the given frame is dirty and should be redrawn.

source

fn set_hidden(&mut self, hidden: bool)

Set the frame as hidden.

The frame must be visible by default.

source

fn is_hidden(&self) -> bool

Get the frame hidden state.

Get the state of the last DecorationsFrame::set_hidden.

source

fn set_resizable(&mut self, resizable: bool)

Mark the frame as resizable.

By default the frame is resizable.

source

fn draw(&mut self) -> bool

Draw the decorations frame.

Return true when the main surface must be redrawn as well. This usually happens when sync is being set on the internal subsurfaces and they’ve changed their size.

The user of the frame must commit the base surface afterwards.

source

fn set_title(&mut self, title: impl Into<String>)

Set the frames title.

Object Safety§

This trait is not object safe.

Implementors§