Struct wayland_window::SurfaceGuard [] [src]

pub struct SurfaceGuard<'a, S: Surface + 'a> {
    // some fields omitted
}

A wrapper around a reference to the surface you stored in a DecoratedSurface.

It allows you to access the ShellSurface object via deref (and thus the surface itself as well).

Methods from Deref<Target=ShellSurface<S>>

fn destroy(self) -> S

Frees the Surface from its role of shell_surface and returns it.

fn start_move(&self, seat: &Seat, serial: Serial)

Start an interactive move

This method must be called in response of a button-press event, and have the appropriate serial passed as well as the concerned Seat.

The compositor is allowed to ignore the request depending on the state of the surface.

fn start_resize(&self, seat: &Seat, serial: Serial, edges: ShellSurfaceResize)

Start a pointer-driven resizing of the surface.

This method must be called in response of a button-press event, and have the appropriate serial passed as well as the concerned Seat.

The compositor is allowed to ignore the request depending on the state of the surface.

fn set_toplevel(&self)

Set this shell surface as being a toplevel window.

It is the most classic window kind.

fn set_transient<R>(&self, parent: &R, x: i32, y: i32, flags: ShellSurfaceTransient) where R: Surface

Set this shell surface as being a transient surface.

This can be used for tooltip boxes for example. Transient surfaces are mapped relative to a parent surface, at coordinates x and y.

fn set_popup<R>(&self, serial: Serial, seat: &Seat, parent: &R, x: i32, y: i32, flags: ShellSurfaceTransient) where R: Surface

Set this shell surface as being a popup.

Popups have an implicit pointer grab, linked to a given seat. The initial location of the popup is set by coordinates x and y relative to the parent surface.

Popup creation must be done in reaction to and event and provide its Serial.

If the popup grab is broken (when the user clicks outside of this program's surfaces), an event is generated. See the popup_done callback.

fn set_fullscreen(&self, method: ShellFullscreenMethod, output: Option<&Output>)

Set this shell surface as being fullscreen.

If no output is provided, the compositor will choose the output itself.

fn set_maximised(&self, output: Option<&Output>)

Set this shell surface as being maximised.

If no output is provided, the compositor will choose the output itself.

fn set_title(&self, title: &CStr)

Sets the shell surface title.

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

fn set_class(&self, title: &CStr)

Sets the shell surface class.

The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name of the application's .desktop file as the class.

fn set_configure_callback<F>(&mut self, f: F) where F: Fn(ShellSurfaceResize, i32, i32) -> () + 'static + Send + Sync

Sets the callback to be invoked when a configure event is received for this shell surface.

These events are generated then the window is resized, and provide a hint of the new expected size. It is not a mandatory size, the client can still do has it pleases.

The arguments of the callback are:

  • an enum ShellSurfaceResize, which is an hint about which border of the surface was resized
  • the new width
  • the new height

fn set_popup_done_callback<F>(&mut self, f: F) where F: Fn() -> () + 'static + Send + Sync

Sets the callback to be invoked when the popup grab of this popup surface is broken. See set_popup() for details.

Will never be called if the surface is not a popup.

Trait Implementations

impl<'a, S: Surface + 'a> Deref for SurfaceGuard<'a, S>

type Target = ShellSurface<S>

fn deref(&self) -> &ShellSurface<S>

impl<'a, S: Surface + 'a> DerefMut for SurfaceGuard<'a, S>

fn deref_mut(&mut self) -> &mut ShellSurface<S>