Struct runa_orbiter::shell::surface::Surface
source · pub struct Surface<S: Shell> { /* private fields */ }
Expand description
A surface.
Implementations§
source§impl<S: Shell> Surface<S>
impl<S: Shell> Surface<S>
sourcepub fn parent(&self) -> Option<Rc<Self>>
pub fn parent(&self) -> Option<Rc<Self>>
Get the parent surface of this surface has a subsurface role.
sourcepub fn root(self: &Rc<Self>) -> Rc<Self>
pub fn root(self: &Rc<Self>) -> Rc<Self>
Follow the parent link of this surface until the root is reached.
sourcepub fn commit(
&self,
shell: &mut S,
scratch_buffer: &mut Vec<S::Token>
) -> Result<(), &'static str>
pub fn commit( &self, shell: &mut S, scratch_buffer: &mut Vec<S::Token> ) -> Result<(), &'static str>
Commit the pending state to the current state.
Arguments
shell
- The shell to use to get the current state.scratch_buffer
- A scratch buffer to use for temporary storage. we take this argument so we don’t have to allocate a new buffer every time.
Returns if the commit is successful.
TODO: FIXME: this implementation of commit is inaccurate. Per wayland spec, the pending state is not a shadow state, where changes are applied to. Instead it’s a collection of pending changes, that are applied to the current state when commited. The difference is subtle. For example, if buffer transform changes between two damage_buffer requests, both requests should use the new transform; instead of the first using the old transform and the second using the new transform.
sourcepub fn object_id(&self) -> u32
pub fn object_id(&self) -> u32
Return the object ID of this surface inside the object store of the client owning this surface.
sourcepub fn set_current(&self, key: S::Token)
pub fn set_current(&self, key: S::Token)
Set the current surface state
sourcepub fn set_pending(&self, key: S::Token)
pub fn set_pending(&self, key: S::Token)
Set the pending surface state.
TODO: this is wrong
sourcepub fn pending_key(&self) -> S::Token
pub fn pending_key(&self) -> S::Token
Get the pending surface state token.
TODO: this is wrong
sourcepub fn current_key(&self) -> S::Token
pub fn current_key(&self) -> S::Token
Get the current surface state token.
sourcepub fn pending_mut<'a>(&self, shell: &'a mut S) -> &'a mut SurfaceState<S>
pub fn pending_mut<'a>(&self, shell: &'a mut S) -> &'a mut SurfaceState<S>
Get a unique reference to the pending surface state.
sourcepub fn pending<'a>(&self, shell: &'a S) -> &'a SurfaceState<S>
pub fn pending<'a>(&self, shell: &'a S) -> &'a SurfaceState<S>
Get a reference to the pending surface state.
sourcepub fn current<'a>(&self, shell: &'a S) -> &'a SurfaceState<S>
pub fn current<'a>(&self, shell: &'a S) -> &'a SurfaceState<S>
Get a reference to the current surface state.
sourcepub fn current_mut<'a>(&self, shell: &'a mut S) -> &'a mut SurfaceState<S>
pub fn current_mut<'a>(&self, shell: &'a mut S) -> &'a mut SurfaceState<S>
Get a unique reference to the current surface state.
sourcepub fn has_role(&self) -> bool
pub fn has_role(&self) -> bool
Returns true if the surface has a role attached. This will keep returning true even after the role has been deactivated.
sourcepub fn role_is_active(&self) -> bool
pub fn role_is_active(&self) -> bool
Returns true if the surface has a role, and that role is active.
sourcepub fn role_mut<T: Role<S>>(&self) -> Option<RefMut<'_, T>>
pub fn role_mut<T: Role<S>>(&self) -> Option<RefMut<'_, T>>
Mutably borrow the role object of the surface.
sourcepub fn destroy(&self, shell: &mut S, scratch_buffer: &mut Vec<S::Token>)
pub fn destroy(&self, shell: &mut S, scratch_buffer: &mut Vec<S::Token>)
Destroy a surface and its associated resources.
This function will deactivate the role associated with the surface, if any. (Although, as specified by wl_surface interface v6, the role must be destroyed before the surface. We keep the deactivation here too to support older clients). And also destruct any associated surface states that become orphaned by destroying the surface.
Arguments
shell
: the shell that owns this surface.scratch_buffer
: a scratch buffer used to store the tokens of the surface states for going through them.
sourcepub fn deactivate_role(&self, shell: &mut S)
pub fn deactivate_role(&self, shell: &mut S)
Deactivate the role assigned to this surface.
sourcepub fn clear_damage(&self)
pub fn clear_damage(&self)
Clear buffer damage, NOT IMPLEMENTED YET
sourcepub fn outputs(&self) -> Ref<'_, HashSet<WeakPtr<Output>>>
pub fn outputs(&self) -> Ref<'_, HashSet<WeakPtr<Output>>>
Get the set of outputs this surface is currently on.
sourcepub fn outputs_mut(&self) -> RefMut<'_, HashSet<WeakPtr<Output>>>
pub fn outputs_mut(&self) -> RefMut<'_, HashSet<WeakPtr<Output>>>
Mutably borrow the set of outputs this surface is currently on.
sourcepub fn notify_output_changed(&self)
pub fn notify_output_changed(&self)
Send an event notifying that the set of outputs this surface is on has changed.
sourcepub fn notify_layout_changed(&self, layout: Layout)
pub fn notify_layout_changed(&self, layout: Layout)
Send an event notifying that the layout of this surface has changed.
sourcepub fn pointer_event(&self, event: PointerActivity)
pub fn pointer_event(&self, event: PointerActivity)
Send a pointer event
sourcepub fn keyboard_event(&self, event: KeyboardActivity)
pub fn keyboard_event(&self, event: KeyboardActivity)
Send a keyboard event