pub struct Surface { /* private fields */ }
Expand description

A Surface is the object backing wl_surface protocol objects.

A Surface alone is not of much use until it’s been assigned a role. Surface roles are assigned implicitly when binding the role object to the surface.

For example, the request wl_shell::get_shell_surface(new_id, object<wl_surface>) will create a new wl_shell_surface object for the provided surface. When this happens we assign the wl_shell_surface role to the underlying wl_surface object. Once a surface has been assigned a role, it is an error to attempt to assign it a different role.

Implementations§

source§

impl Surface

source

pub fn enqueue(&mut self, command: SurfaceCommand)

Enqueues a command for this surface to take effect on the next call to wl_surface::commit.

source

pub fn detach_subsurface(&mut self, subsurface_ref: ObjectRef<Subsurface>)

source

pub fn set_role(&mut self, role: SurfaceRole) -> Result<(), Error>

Assigns a role to this surface.

The role can be updated as long as the type of role remains the same, it is an error to set a different type of role for that same surface.

source

pub fn set_parent_and_offset( &mut self, parent: Option<ObjectRef<Surface>>, x: i32, y: i32 )

source

pub fn window_geometry(&self) -> Rect

source

pub fn offset(&self) -> Option<(i32, i32)>

source

pub fn hit_test( &self, x: f32, y: f32, client: &Client ) -> Option<(ObjectRef<Self>, (i32, i32))>

source

pub fn new(id: ObjectId) -> Self

Creates a new Surface.

source

pub fn set_flatland(&mut self, flatland: FlatlandPtr) -> Result<(), Error>

Assigns the Flatland instance for this surface.

When a surface is initially created, it has no Flatland instance. Since the instance is used to create the Flatland resources backing the surface, a wl_surface must have an assigned an instance before it is committed.

Ex: for xdg_toplevel surfaces, the a new instance will be created for each toplevel.

It is an error to call set_flatland multiple times for the same surface.

source

pub fn clear_flatland(&mut self)

source

pub fn flatland(&self) -> Option<FlatlandPtr>

source

pub fn transform(&self) -> Option<&TransformId>

Returns a reference to the TransformId for this surface.

source

pub fn take_on_next_frame_begin_callbacks(&mut self) -> Vec<ObjectRef<Callback>>

source

pub fn present_internal(this: ObjectRef<Self>, client: &mut Client)

source

pub fn present( this: ObjectRef<Self>, client: &mut Client, callbacks: Vec<ObjectRef<Callback>> )

source

pub fn add_present_credits( this: ObjectRef<Self>, client: &mut Client, present_credits: u32 )

Trait Implementations§

source§

impl RequestReceiver<WlSurface> for Surface

source§

fn receive( this: ObjectRef<Self>, request: WlSurfaceRequest, client: &mut Client ) -> Result<(), Error>

Handle a decoded message for the associated |Interface|. Read more

Auto Trait Implementations§

§

impl Freeze for Surface

§

impl !RefUnwindSafe for Surface

§

impl !Send for Surface

§

impl !Sync for Surface

§

impl Unpin for Surface

§

impl !UnwindSafe for Surface

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<St> WithTag for St

source§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag