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
impl Surface
Sourcepub fn enqueue(&mut self, command: SurfaceCommand)
pub fn enqueue(&mut self, command: SurfaceCommand)
Enqueues a command for this surface to take effect on the next call to wl_surface::commit.
pub fn detach_subsurface(&mut self, subsurface_ref: ObjectRef<Subsurface>)
Sourcepub fn set_role(&mut self, role: SurfaceRole) -> Result<(), Error>
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.
pub fn set_parent_and_offset( &mut self, parent: Option<ObjectRef<Surface>>, x: i32, y: i32, )
pub fn window_geometry(&self) -> Rect
pub fn offset(&self) -> Option<(i32, i32)>
pub fn hit_test( &self, x: f32, y: f32, client: &Client, ) -> Option<(ObjectRef<Self>, (i32, i32))>
Sourcepub fn set_flatland(&mut self, flatland: FlatlandPtr) -> Result<(), Error>
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.
pub fn clear_flatland(&mut self)
pub fn flatland(&self) -> Option<FlatlandPtr>
Sourcepub fn transform(&self) -> Option<&TransformId>
pub fn transform(&self) -> Option<&TransformId>
Returns a reference to the TransformId
for this surface.
pub fn take_on_next_frame_begin_callbacks(&mut self) -> Vec<ObjectRef<Callback>>
pub fn present_internal(this: ObjectRef<Self>, client: &mut Client)
pub fn present( this: ObjectRef<Self>, client: &mut Client, callbacks: Vec<ObjectRef<Callback>>, )
pub fn add_present_credits( this: ObjectRef<Self>, client: &mut Client, present_credits: u32, )
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more