Struct runa_orbiter::shell::surface::roles::Subsurface
source · pub struct Subsurface<S: Shell> { /* private fields */ }
Expand description
The wl_subsurface
role.
Note about cache and pending states
A surface normally has a pending and a current state. Changes are
applied to the pending state first, then commited to the current
state when wl_surface.commit
is called.
Subsurfaces has one more state - the cached state. This state exists if the subsurface is in synchronized mode. In sync mode, commit applies pending state to a cached state, and the cached state is applied to current state when the parent calls commit, if the partent is desynced; otherwise the cached state becomes part of the parent’s cached state.
We can see this as a tree of surface states, rooted at a “top-level”
surface, such as a surface with the xdg_toplevel
role. The root’s
current state references the children’s current states, and the
children’s current states in turn reference the grand-children’s, so
on and so forth. When a synced child commits, its current state updates,
but it doesn’t update its parent’s reference to its current state.
So the parent still references the previous state, until the parent
also commits.
A complication is when a child is destroyed, either by destroying the surface or deactivating its role, it’s immediately removed, without going through the pending or the cached state. We can detect this by checking if the role object is active, while going through the tree of surfaces.
Implementations§
Trait Implementations§
source§impl<S: Shell> Clone for Subsurface<S>
impl<S: Shell> Clone for Subsurface<S>
source§impl<S: Shell> Role<S> for Subsurface<S>
impl<S: Shell> Role<S> for Subsurface<S>
source§fn deactivate(&mut self, shell: &mut S)
fn deactivate(&mut self, shell: &mut S)
source§fn provide<'a>(&'a self, demand: &mut Demand<'a>)
fn provide<'a>(&'a self, demand: &mut Demand<'a>)
source§fn provide_mut<'a>(&'a mut self, demand: &mut Demand<'a>)
fn provide_mut<'a>(&'a mut self, demand: &mut Demand<'a>)
source§fn post_commit(&mut self, shell: &mut S, surface: &Surface<S>)
fn post_commit(&mut self, shell: &mut S, surface: &Surface<S>)
Surface::commit
source§fn pre_commit(
&mut self,
_shell: &mut S,
_surfacee: &Surface<S>
) -> Result<(), &'static str>
fn pre_commit( &mut self, _shell: &mut S, _surfacee: &Surface<S> ) -> Result<(), &'static str>
Surface::commit
. If an error is returned, the commit will be
stopped.