Trait smithay_client_toolkit::window::Frame
source · pub trait Frame: Sized {
type Error;
type Config;
Show 13 methods
// Required methods
fn init(
base_surface: &WlSurface,
compositor: &Attached<WlCompositor>,
subcompositor: &Attached<WlSubcompositor>,
shm: &Attached<WlShm>,
theme_manager: Option<ThemeManager>,
callback: Box<dyn FnMut(FrameRequest, u32, DispatchData<'_>)>
) -> Result<Self, Self::Error>;
fn set_states(&mut self, states: &[State]) -> bool;
fn set_hidden(&mut self, hidden: bool);
fn set_resizable(&mut self, resizable: bool);
fn new_seat(&mut self, seat: &Attached<WlSeat>);
fn remove_seat(&mut self, seat: &WlSeat);
fn resize(&mut self, newsize: (u32, u32));
fn redraw(&mut self);
fn subtract_borders(&self, width: i32, height: i32) -> (i32, i32);
fn add_borders(&self, width: i32, height: i32) -> (i32, i32);
fn set_config(&mut self, config: Self::Config);
fn set_title(&mut self, title: String);
// Provided method
fn location(&self) -> (i32, i32) { ... }
}
Expand description
Interface for defining the drawing of decorations
A type implementing this trait can be used to define custom
decorations additionnaly to the ones provided by this crate
and be used with Window
.
Required Associated Types§
Required Methods§
sourcefn init(
base_surface: &WlSurface,
compositor: &Attached<WlCompositor>,
subcompositor: &Attached<WlSubcompositor>,
shm: &Attached<WlShm>,
theme_manager: Option<ThemeManager>,
callback: Box<dyn FnMut(FrameRequest, u32, DispatchData<'_>)>
) -> Result<Self, Self::Error>
fn init( base_surface: &WlSurface, compositor: &Attached<WlCompositor>, subcompositor: &Attached<WlSubcompositor>, shm: &Attached<WlShm>, theme_manager: Option<ThemeManager>, callback: Box<dyn FnMut(FrameRequest, u32, DispatchData<'_>)> ) -> Result<Self, Self::Error>
Initialize the Frame.
Providing non None
to theme_manager
should prevent Frame
to theme pointer
over base_surface
surface.
sourcefn set_states(&mut self, states: &[State]) -> bool
fn set_states(&mut self, states: &[State]) -> bool
Set the Window XDG states for the frame
This notably includes information about whether the window is maximized, active, or tiled, and can affect the way decorations are drawn.
Calling this should not trigger a redraw, but return true
if
a redraw is needed.
Hide or show the decorations
Calling this should not trigger a redraw
sourcefn set_resizable(&mut self, resizable: bool)
fn set_resizable(&mut self, resizable: bool)
Set whether interactive resize hints should be displayed and reacted to
sourcefn new_seat(&mut self, seat: &Attached<WlSeat>)
fn new_seat(&mut self, seat: &Attached<WlSeat>)
Notify that a new wl_seat should be handled
This seat is guaranteed to have pointer capability
sourcefn remove_seat(&mut self, seat: &WlSeat)
fn remove_seat(&mut self, seat: &WlSeat)
Notify that this seat has lost the pointer capability or has been lost
sourcefn resize(&mut self, newsize: (u32, u32))
fn resize(&mut self, newsize: (u32, u32))
Change the size of the decorations
Calling this should not trigger a redraw
sourcefn subtract_borders(&self, width: i32, height: i32) -> (i32, i32)
fn subtract_borders(&self, width: i32, height: i32) -> (i32, i32)
Subtracts the border dimensions from the given dimensions.
sourcefn add_borders(&self, width: i32, height: i32) -> (i32, i32)
fn add_borders(&self, width: i32, height: i32) -> (i32, i32)
Adds the border dimensions to the given dimensions.
sourcefn set_config(&mut self, config: Self::Config)
fn set_config(&mut self, config: Self::Config)
Sets the configuration for the frame