Trait WaylandSurface

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) { ... }
}
Available on crate feature wayland and Linux only.
Expand description

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

Required Methods§

fn wl_surface(&self) -> &WlSurface

The underlying 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)

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).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§