Skip to main content

SurfaceGraph

Struct SurfaceGraph 

Source
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

Source

pub fn new() -> Self

Source

pub fn surfaces(&self) -> &[Surface]

Source

pub fn get(&self, id: &str) -> Option<&Surface>

Source

pub fn role_of(&self, id: &str) -> Option<Role>

Source

pub fn mains(&self) -> Vec<&Surface>

Source

pub fn asides(&self) -> Vec<&Surface>

Source

pub fn floats(&self) -> Vec<&Surface>

Source

pub fn insert(&mut self, surface: Surface)

Insert (or replace by id) a surface, then re-converge invariants.

Source

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).

Source

pub fn set_active_main(&mut self, id: &str) -> bool

Switch which main is primary. No-op if id is not an existing main.

Source

pub fn set_focus(&mut self, id: &str) -> bool

Focus any surface (any role).

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn check_invariants(&self) -> Vec<String>

Check the invariants. Returns the list of violations (empty = ok).

Source

pub fn is_valid(&self) -> bool

Source

pub fn derive_layout(&self, size_class: SizeClass) -> DerivedLayout

Two-axis derivation: produce the platform-agnostic DerivedLayout.

Source

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).

Source

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

Source§

fn clone(&self) -> SurfaceGraph

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SurfaceGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SurfaceGraph

Source§

fn default() -> SurfaceGraph

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SurfaceGraph

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SurfaceGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.