Struct wayland_client::core::compositor::WSurface [] [src]

pub struct WSurface {
    // some fields omitted
}

A wayland Surface.

This is the basic drawing surface. A surface needs to be assigned a role and a buffer to be properly drawn on screen.

Methods

impl WSurface

fn attach(&self, buffer: &Buffer, x: i32, y: i32)

Attaches given buffer to be the content of the image.

The buffer is by the server to display it. If the content of the buffer change, it should be notified to the server by using the Surface::damage(..) method.

If the attached buffer is destroyed while still in use, the content of the window becomes undefined.

All coordinates are computed relative to the top-left corder of the buffer.

This state is double-buffered, and require a call to Surface::commit() to be applied.

fn commit(&self)

Commit the changes to the server.

Atomically apply all the pending changes on this surface, on the order in which they were requested.

fn damage(&self, x: i32, y: i32, width: i32, height: i32)

Mark part of this surface as damaged.

Damaged area will be repainted by the server. This can be used to notify the server about a change in the buffer contents.

(x, y) are he coordinate of the top-left corner.

This state is double-buffered, and require a call to Surface::commit() to be applied.

fn get_id(&self) -> SurfaceId

Returns the unique SurfaceId associated to this surface.

This struct can be tested for equality, and will be provided in event callbacks as a mean to identify the surface associated with the events.

fn set_opaque_region(&self, region: &Region)

Sets the opaque region of this surface.

Marking part of a region as opaque allow the compositer to make optimisations on the drawing process (a window behind an opaque region does not need to be drawn).

Marking as opaque a region that is actually transparent in the buffer data can cause drawing artifacts.

By default the surface is marked as fully transparent.

This state is double-buffered, and require a call to Surface::commit() to be applied.

fn set_input_region(&self, region: &Region)

Sets the input region of this surface.

By default the surface has no input region.

This state is double-buffered, and require a call to Surface::commit() to be applied.

fn set_buffer_transform(&self, transform: OutputTransform)

Sets the transformation the server will apply to the buffer.

The default value is OutputTransform::WL_OUTPUT_TRANSFORM_NORMAL.

This state is double-buffered, and require a call to Surface::commit() to be applied.

fn set_buffer_scale(&self, scale: i32)

Sets the scale the server will apply to the buffer.

The drawed data will be of dimensions (width/scale, height/scale).

Scale must be positive or will be refused by the server.

This state is double-buffered, and require a call to Surface::commit() to be applied.

Trait Implementations

impl Send for WSurface

impl Sync for WSurface

impl Drop for WSurface

fn drop(&mut self)

impl FFI for WSurface

type Ptr = wl_surface

fn ptr(&self) -> *const wl_surface

unsafe fn ptr_mut(&self) -> *mut wl_surface

impl Surface for WSurface

fn get_wsurface(&self) -> &WSurface