wayland_bridge::compositor

Struct Surface

Source
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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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>,

Source§

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>,

Source§

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