Trait wayland_csd_frame::DecorationsFrame
source · 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§
sourcefn on_click(
&mut self,
timestamp: Duration,
click: FrameClick,
pressed: bool
) -> Option<FrameAction>
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
.
sourcefn click_point_moved(
&mut self,
timestamp: Duration,
surface_id: &ObjectId,
x: f64,
y: f64
) -> Option<CursorIcon>
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.
sourcefn click_point_left(&mut self)
fn click_point_left(&mut self)
All clicks left the decorations.
This function should be called when input leaves the decorations.
sourcefn update_state(&mut self, state: WindowState)
fn update_state(&mut self, state: WindowState)
Update the state of the frame.
The state is usually obtained from the xdg_toplevel::configure
event.
sourcefn update_wm_capabilities(&mut self, wm_capabilities: WindowManagerCapabilities)
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.
sourcefn resize(&mut self, width: NonZeroU32, height: NonZeroU32)
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.
sourcefn set_scaling_factor(&mut self, scale_factor: f64)
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.
sourcefn location(&self) -> (i32, i32)
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.
sourcefn subtract_borders(
&self,
width: NonZeroU32,
height: NonZeroU32
) -> (Option<NonZeroU32>, Option<NonZeroU32>)
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.
sourcefn add_borders(&self, width: u32, height: u32) -> (u32, u32)
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.
Set the frame as hidden.
The frame must be visible by default.
Get the frame hidden state.
Get the state of the last DecorationsFrame::set_hidden
.
sourcefn set_resizable(&mut self, resizable: bool)
fn set_resizable(&mut self, resizable: bool)
Mark the frame as resizable.
By default the frame is resizable.