pub trait WaylandSurface: Sized {
    // Required method
    fn wl_surface(&self) -> &WlSurface;

    // Provided methods
    fn attach(&self, buffer: Option<&WlBuffer>, x: u32, y: u32) { ... }
    fn set_opaque_region(&self, region: Option<&WlRegion>) { ... }
    fn set_input_region(&self, region: Option<&WlRegion>) { ... }
    fn set_buffer_transform(
        &self,
        transform: Transform
    ) -> Result<(), Unsupported> { ... }
    fn set_buffer_scale(&self, scale: u32) -> Result<(), Unsupported> { ... }
    fn offset(&self, x: u32, y: u32) -> Result<(), Unsupported> { ... }
    fn commit(&self) { ... }
}
Expand description

Functionality shared by all wl_surface::WlSurface backed shell role objects.

Required Methods§

source

fn wl_surface(&self) -> &WlSurface

The underlying WlSurface.

Provided Methods§

source

fn attach(&self, buffer: Option<&WlBuffer>, x: u32, y: u32)

source

fn set_opaque_region(&self, region: Option<&WlRegion>)

source

fn set_input_region(&self, region: Option<&WlRegion>)

source

fn set_buffer_transform(&self, transform: Transform) -> Result<(), Unsupported>

source

fn set_buffer_scale(&self, scale: u32) -> Result<(), Unsupported>

source

fn offset(&self, x: u32, y: u32) -> Result<(), Unsupported>

source

fn commit(&self)

Commits pending surface state.

On commit, the pending double buffered state from the surface, including role dependent state is applied.

Initial commit

In many protocol extensions, the concept of an initial commit is used. A initial commit provides the initial state of a surface to the compositor. For example with the xdg shell, creating a window requires an initial commit.

Protocol Errors

If the commit is the initial commit, no buffers must have been attached to the surface. This rule applies whether attaching the buffer was done using WaylandSurface::attach or under the hood in via window system integration in graphics APIs such as Vulkan (using vkQueuePresentKHR) and EGL (using eglSwapBuffers).

Object Safety§

This trait is not object safe.

Implementors§