Struct runa_orbiter::shell::surface::SurfaceState
source · pub struct SurfaceState<S: Shell> { /* private fields */ }
Expand description
To support the current state and the pending state double buffering, the surface state must be deep cloneable.
Implementations§
source§impl<S: Shell> SurfaceState<S>
impl<S: Shell> SurfaceState<S>
sourcepub fn stack(&self) -> &VecList<SurfaceStackEntry<S>>
pub fn stack(&self) -> &VecList<SurfaceStackEntry<S>>
Returns a reference to the surface stack in this surface state
sourcepub fn stack_mut(&mut self) -> &mut VecList<SurfaceStackEntry<S>>
pub fn stack_mut(&mut self) -> &mut VecList<SurfaceStackEntry<S>>
Returns unique reference to the surface stack in this surface state
source§impl<S: Shell> SurfaceState<S>
impl<S: Shell> SurfaceState<S>
sourcepub fn parent(&self) -> Option<S::Token>
pub fn parent(&self) -> Option<S::Token>
Returns the token of the parent surface state of this surface state, if any. None if this surface is not a subsurface.
sourcepub fn top(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)
pub fn top(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)
Find the top of the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.
sourcepub fn next_in_stack(
&self,
index: Index<SurfaceStackEntry<S>>,
shell: &S
) -> Option<(S::Token, Point<i32, Surface>)>
pub fn next_in_stack( &self, index: Index<SurfaceStackEntry<S>>, shell: &S ) -> Option<(S::Token, Point<i32, Surface>)>
The the surface on top of the index
surface in the subtree rooted at
this surface. Returns the token, and it’s offset relative to this
surface.
Example
Say surface A has stack “B A C D”, and surface D has stack “E D F G”.
Then A.next_in_stack(C)
will return E. Because D is the next surface
of C in A’s stack, and the first surface of D’s stack is E.
sourcepub fn bottom(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)
pub fn bottom(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)
Find the bottom of the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.
Example
Say surface A has stack “B A C D”, and surface B has stack “E D F G”.
Then A.bottom()
will return E. Because B is the bottom
of A’s immediate stack, and the bottom surface of B’s stack is E.
sourcepub fn prev_in_stack(
&self,
index: Index<SurfaceStackEntry<S>>,
shell: &S
) -> Option<(S::Token, Point<i32, Surface>)>
pub fn prev_in_stack( &self, index: Index<SurfaceStackEntry<S>>, shell: &S ) -> Option<(S::Token, Point<i32, Surface>)>
The the surface beneath the index
surface in the subtree rooted at
this surface. Returns the token, and it’s offset relative to this
surface.
Example
Say surface A has stack “B A C D”, and surface C has stack “E C F G”.
Then A.prev_in_stack(D)
will return G. Because C is the previous
surface of D in A’s stack, and the bottom most surface of C’s stack
is G.
sourcepub fn buffer_scale_f32(&self) -> Scale<NotNan<f32>>
pub fn buffer_scale_f32(&self) -> Scale<NotNan<f32>>
Return the buffer scale
sourcepub fn set_buffer_scale(&mut self, scale: u32)
pub fn set_buffer_scale(&mut self, scale: u32)
Set the buffer scale
sourcepub fn surface(&self) -> &Weak<Surface<S>>
pub fn surface(&self) -> &Weak<Surface<S>>
Get a weak reference to the surface this surface state belongs to.
sourcepub fn damage_buffer(&mut self)
pub fn damage_buffer(&mut self)
Mark the surface’s buffer as damaged. No-op if the surface has no buffer.
sourcepub fn set_buffer_from_object(&mut self, buffer: &Buffer<S::Buffer>)
pub fn set_buffer_from_object(&mut self, buffer: &Buffer<S::Buffer>)
Set the buffer.
sourcepub fn add_frame_callback(&mut self, callback: u32)
pub fn add_frame_callback(&mut self, callback: u32)
Add a frame callback.
sourcepub fn set_role_state<T: RoleState>(&mut self, state: T)
pub fn set_role_state<T: RoleState>(&mut self, state: T)
Set role related state.
sourcepub fn role_state<T: RoleState>(&self) -> Option<Option<&T>>
pub fn role_state<T: RoleState>(&self) -> Option<Option<&T>>
Get a reference to the role related state.
None if there is no role related state assigned to this surface.
Some(None) if T
is not the correct type.