Skip to main content

Crate term_wm_layout_engine

Crate term_wm_layout_engine 

Source
Expand description

Pure-math window layout engine for term-wm.

Provides tiling (BSP/N-ary tree) and floating window layout math with zero runtime dependencies. Supports no_std via the std feature (enabled by default).

Structs§

DragHandle
A hit-test region for the title bar of a floating window.
EdgeResistance
FocusRing
A cyclic focus ring with a single current item.
HeaderDrag
State of an in-progress header drag (move).
LayoutRect
A rectangle with signed origin and unsigned dimensions.
LongestSide
Splits along the longer side of the area (width ≥ height → Horizontal).
MousePosition
A mouse cursor position with an explicit coordinate space tag.
Ratio
An integer ratio (p, q) meaning p/(p+q) of the parent’s size.
RegionMap
A map from ID to rectangle, with hit-testing support.
ResizeDrag
State of an in-progress resize drag.
ResizeHandle
A single-cell hit-test handle at a corner or along an edge of a floating window.
ScrollState
Scroll state for a scrollable viewport.
SizeConstraints
Minimum dimensions enforced by tree mutation functions.
SnapPreview
Spiral
Cycles Horizontal, Vertical, Horizontal, Vertical, … based on depth.
SplitGap
ZOrder
A flat z-order list. The last element is the top-most (front-most) item.

Enums§

BspNode
A strict binary (BSP) split tree.
CoordSpace
Distinguishes coordinate spaces to prevent accidental mixing.
Direction
InsertPosition
LayoutError
Errors returned by tree mutation operations.
LayoutNode
NaryNode
Orientation
The direction children are stacked in a split container.
Quadrant
Which diagonal quadrant of a rectangle a point falls in.
RectSpec
A rectangle specification that can be either absolute or percentage-based.
ResizeEdge
Identifies which edge(s) of a floating window are being dragged.
SnapTarget

Constants§

FLOATING_MIN_HEIGHT
Minimum height for a floating window (in cells).
FLOATING_MIN_WIDTH
Minimum width for a floating window (in cells).

Traits§

LayoutEngine
Common interface for tree-based layout engines (BSP and N-ary).
OrientationHeuristic
Decides which orientation to use when splitting an area.

Functions§

apply_resize_drag_signed
Apply a resize drag delta to a floating window’s geometry.
build_rects_from_sizes
Build rects from a list of per-child sizes along an orientation.
corner_preview_rect
Compute a corner (quarter-screen) preview rect.
detect_corner_snap
Detect a corner snap when the cursor is simultaneously within sensitivity of both an X edge and a Y edge. Uses saturating arithmetic exclusively.
detect_edge_snap
detect_quadrant
Determine which diagonal quadrant of target the cursor falls in.
edge_preview_rect
find_closest_region
Find the region whose center is nearest to (cx, cy) using aspect-ratio-weighted Euclidean distance. Returns None for empty input.
floating_header_for_region
Generate a drag handle for the title bar of a floating window.
gap_insert
Offset a rectangle by gap * index along the given orientation. Used when placing children in a split with inter-child gaps. Generic over gap type.
gap_size
Compute the per-gap size between children in a split.
handle_thickness
Compute the visual thickness of a split handle gap.
hit_test_leaf
Find the top-most (last-in-slice) region that contains (col, row).
inset
Shrink a rectangle by the given margins on each side. The resulting width/height saturate at zero. Generic over margin types.
rect_contains
Convenience wrapper around LayoutRect::contains. Generic over coordinate type.
resize_handles_for_region
Generate all 8 resize handles (4 corners + 4 edges) for a floating region.
resolve_target
Two-phase target resolution for spatial insertion:
split_area_for_path
split_at_path_mut
split_rect_bsp
Split a rectangle into two along the given orientation using a ratio.
split_rects_nary
split_rects_weighted
Weighted split of a rect into child_count rects using integer weights.
split_rects_with_gaps
Split a rect into child_count rects separated by gap-width gaps.
split_sizes
Extract the per-child dimension sizes from a split result.
tiled_preview_rect