pub struct SurfaceGraph {
pub active_main_id: Option<SurfaceId>,
pub focused_surface_id: Option<SurfaceId>,
/* private fields */
}Expand description
One window’s graph. Surfaces are kept in insertion order so that “adjacent main” succession and “oldest aside” replacement are deterministic.
Fields§
§active_main_id: Option<SurfaceId>§focused_surface_id: Option<SurfaceId>Implementations§
Source§impl SurfaceGraph
impl SurfaceGraph
pub fn new() -> Self
pub fn surfaces(&self) -> &[Surface]
pub fn get(&self, id: &str) -> Option<&Surface>
pub fn role_of(&self, id: &str) -> Option<Role>
pub fn mains(&self) -> Vec<&Surface>
pub fn asides(&self) -> Vec<&Surface>
pub fn floats(&self) -> Vec<&Surface>
Sourcepub fn insert(&mut self, surface: Surface)
pub fn insert(&mut self, surface: Surface)
Insert (or replace by id) a surface, then re-converge invariants.
Sourcepub fn remove(&mut self, id: &str) -> Vec<SurfaceId> ⓘ
pub fn remove(&mut self, id: &str) -> Vec<SurfaceId> ⓘ
Remove a surface and re-converge per the transition rules. Returns the ids actually removed (the target, plus cascaded asides).
Sourcepub fn set_active_main(&mut self, id: &str) -> bool
pub fn set_active_main(&mut self, id: &str) -> bool
Switch which main is primary. No-op if id is not an existing main.
Sourcepub fn show(&mut self, id: &str) -> bool
pub fn show(&mut self, id: &str) -> bool
Show a live surface without changing its identity. Main selection is handled separately; aside/float visibility is represented in the graph.
Sourcepub fn hide(&mut self, id: &str) -> bool
pub fn hide(&mut self, id: &str) -> bool
Hide a live aside/float while retaining it. Hiding the active child of an aside slot selects that slot’s most-recent visible sibling; when no sibling remains the slot disappears and focus returns to the main.
Sourcepub fn aside_slots_admitted(
&self,
size_class: SizeClass,
width: f64,
policy: &Policy,
) -> Vec<PlanAsideSlot>
pub fn aside_slots_admitted( &self, size_class: SizeClass, width: f64, policy: &Policy, ) -> Vec<PlanAsideSlot>
Group the asides into per-kind slots (lxapp / browser / native), in first-open order, with tab order = open order. Admission marks the most recently used slots visible — the size class caps the count (expanded 3 / medium 1 / compact 0), and physical width caps it further so the main keeps its minimum. Hidden slots stay alive and are never evicted; widening the container brings them back.
width is the container’s workspace width (window minus sidebar) and
policy carries the min-size tokens. See Self::aside_slots for the
size-class-only convenience used by tests.
Sourcepub fn aside_slots(&self, size_class: SizeClass) -> Vec<PlanAsideSlot>
pub fn aside_slots(&self, size_class: SizeClass) -> Vec<PlanAsideSlot>
Size-class-only admission (count ceiling, no physical width). Retained for callers/tests that don’t have a container width.
Sourcepub fn check_invariants(&self) -> Vec<String>
pub fn check_invariants(&self) -> Vec<String>
Check the invariants. Returns the list of violations (empty = ok).
pub fn is_valid(&self) -> bool
Sourcepub fn derive_layout(&self, size_class: SizeClass) -> DerivedLayout
pub fn derive_layout(&self, size_class: SizeClass) -> DerivedLayout
Two-axis derivation: produce the platform-agnostic DerivedLayout.
Sourcepub fn presentation_plan(
&self,
size_class: SizeClass,
width: f64,
policy: &Policy,
) -> LayoutPresentationPlan
pub fn presentation_plan( &self, size_class: SizeClass, width: f64, policy: &Policy, ) -> LayoutPresentationPlan
Flatten the graph + derivation into the stable, skin-bindable
LayoutPresentationPlan: the primary mains, asides (with edge +
preferred size), floats, and the full tree. width is the container
workspace width and policy the admission tokens, so slot visibility
respects both the size-class ceiling and the physical fit (§3.3).
Sourcepub fn canonical_layout(&self, size_class: SizeClass) -> Option<LayoutTree>
pub fn canonical_layout(&self, size_class: SizeClass) -> Option<LayoutTree>
Build the canonical authoritative LayoutTree from current state:
mains → tabs when needed, asides → split. Compact has no side-by-side
dock; asides share the main tree. Floats are never in the tree.
Trait Implementations§
Source§impl Clone for SurfaceGraph
impl Clone for SurfaceGraph
Source§fn clone(&self) -> SurfaceGraph
fn clone(&self) -> SurfaceGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more