[][src]Struct smithay_client_toolkit::window::Window

pub struct Window<F: Frame> { /* fields omitted */ }

A window

This wrapper handles for you the decoration of your window and the interaction with the server regarding the shell protocol.

You are still entirely responsible for drawing the contents of your window.

Note also that as the dimensions of wayland surfaces is defined by their attached buffer, you need to keep the decorations in sync with your contents via the resize(..) method.

Different kind of decorations can be used by customizing the type parameter. A few are provided in this crate, but any type implementing the Frame trait can do.

Methods

impl<F: Frame + 'static> Window<F>[src]

pub fn init_from_env<Impl>(
    env: &Environment,
    surface: WlSurface,
    initial_dims: (u32, u32),
    implementation: Impl
) -> Result<Window<F>, F::Error> where
    Impl: FnMut(Event) + Send + 'static, 
[src]

Create a new window wrapping a given wayland surface as its main content and following the compositor's preference regarding server-side decorations.

pub fn init<Impl>(
    surface: WlSurface,
    initial_dims: (u32, u32),
    compositor: &WlCompositor,
    subcompositor: &WlSubcompositor,
    shm: &WlShm,
    shell: &Shell,
    implementation: Impl
) -> Result<Window<F>, F::Error> where
    Impl: FnMut(Event) + Send + 'static, 
[src]

Create a new window wrapping a given wayland surface as its main content

It can fail if the initialization of the frame fails (for example if the frame class fails to initialize its SHM).

pub fn init_with_decorations<Impl>(
    surface: WlSurface,
    initial_dims: (u32, u32),
    compositor: &WlCompositor,
    subcompositor: &WlSubcompositor,
    shm: &WlShm,
    shell: &Shell,
    decoration_mgr: Option<&ZxdgDecorationManagerV1>,
    implementation: Impl
) -> Result<Window<F>, F::Error> where
    Impl: FnMut(Event) + Send + 'static, 
[src]

Create a new window wrapping a given wayland surface as its main content and following the compositor's preference regarding server-side decorations

It can fail if the initialization of the frame fails (for example if the frame class fails to initialize its SHM).

pub fn new_seat(&mut self, seat: &WlSeat)[src]

Notify this window that a new seat is accessible

This allows the decoration manager to get an handle to the pointer to manage pointer events and change the pointer image appropriately.

pub fn surface(&self) -> &WlSurface[src]

Access the surface wrapped in this Window

pub fn refresh(&mut self)[src]

Refreshes the frame

Redraws the frame to match its requested state (dimensions, presence/ absence of decorations, ...)

You need to call this method after every change to the dimensions or state of the decorations of your window, otherwise the drawn decorations may go out of sync with the state of your content.

Your implementation will also receive Refresh events when the frame requests to be redrawn (to provide some frame animations for example).

pub fn set_title(&self, title: String)[src]

Set a short title for the window.

This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor.

You need to call refresh() afterwards for this to properly take effect.

pub fn set_app_id(&self, app_id: String)[src]

Set an app id for the surface.

The surface class identifies the general class of applications to which the surface belongs.

Several wayland compositors will try to find a .desktop file matching this name to find metadata about your apps.

pub fn set_decorate(&self, decorate: bool)[src]

Set whether the window should be decorated or not

You need to call refresh() afterwards for this to properly take effect.

pub fn set_resizable(&self, resizable: bool)[src]

Set whether the window should be resizeable by the user

This is not an hard blocking, as the compositor can always resize you forcibly if it wants. However it signals it that you don't want this window to be resized.

Additionally, the decorations will stop suggesting the user to resize by dragging the borders if you set the window as non-resizable.

When re-activating resizability, any previously set min/max sizes are restored.

pub fn resize(&mut self, w: u32, h: u32)[src]

Resize the decorations

You should call this whenever you change the size of the contents of your window, with the new inner size of your window.

You need to call refresh() afterwards for this to properly take effect.

pub fn set_maximized(&self)[src]

Request the window to be maximized

pub fn unset_maximized(&self)[src]

Request the window to be un-maximized

pub fn set_minimized(&self)[src]

Request the window to be minimized

pub fn set_fullscreen(&self, output: Option<&WlOutput>)[src]

Request the window to be set fullscreen

Note: you need to manually disable the decorations if you want to hide them!

pub fn unset_fullscreen(&self)[src]

Request the window to quit fullscreen mode

pub fn set_min_size(&mut self, size: Option<(u32, u32)>)[src]

Sets the minimum possible size for this window

Provide either a tuple Some((width, height)) or None to unset the minimum size.

The provided size is the interior size, not counting decorations

pub fn set_max_size(&mut self, size: Option<(u32, u32)>)[src]

Sets the maximum possible size for this window

Provide either a tuple Some((width, height)) or None to unset the maximum size.

The provided size is the interior size, not counting decorations

pub fn set_theme<T: Theme>(&mut self, theme: T)[src]

Sets the theme for the window

Provide a type that implements the 'Theme' trait to adjust the look of the windows decorations

The theme must return colors of the format of ARGB8888

Trait Implementations

impl<F: Frame> Drop for Window<F>[src]

Auto Trait Implementations

impl<F> !RefUnwindSafe for Window<F>

impl<F> Send for Window<F>

impl<F> Sync for Window<F>

impl<F> Unpin for Window<F>

impl<F> !UnwindSafe for Window<F>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.