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 root_main_id(&self) -> Option<&str>
pub fn is_root_main(&self, id: &str) -> bool
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.
pub fn slot_collapsed(&self, kind: SlotKind) -> bool
Sourcepub fn set_slot_collapsed(&mut self, kind: SlotKind, collapsed: bool) -> bool
pub fn set_slot_collapsed(&mut self, kind: SlotKind, collapsed: bool) -> bool
Collapse or restore an aside slot. Returns whether the state changed.
Sourcepub fn close(&mut self, id: &str) -> CloseOutcome
pub fn close(&mut self, id: &str) -> CloseOutcome
Close one surface. The window’s root main is a stable navigation anchor and cannot be closed through ordinary surface lifecycle operations.
Sourcepub fn close_other_mains(&mut self, keeping: &str) -> Vec<SurfaceId> ⓘ
pub fn close_other_mains(&mut self, keeping: &str) -> Vec<SurfaceId> ⓘ
Structurally remove every other non-root main.
User-facing capability filtering belongs to SurfaceManager.
Sourcepub fn close_mains_after(&mut self, id: &str) -> Vec<SurfaceId> ⓘ
pub fn close_mains_after(&mut self, id: &str) -> Vec<SurfaceId> ⓘ
Structurally remove non-root mains after id in stable switcher order.
User-facing capability filtering belongs to SurfaceManager.
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. A main is selected; aside/float visibility is represented by mounted state and focus.
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 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.