Skip to main content

Module window_invariants

Module window_invariants 

Source
Expand description

The window invariants: the registry checked against what is on screen (ADR 0029, slice 2).

Experimental: may change in any release (docs/stability.md).

The registry (AppHandle::windows_list) is the one list of windows and popups. Six rules say it agrees with what egui and the system show; they are checked by pop.window.invariants, the last listener of every window and popup point, and again at the end of every pass of the main window:

  1. BACKEND: the registry’s windows are the backend’s viewports (egui’s raw.viewports), none more, none fewer, past the one pass the backend needs to create or destroy one. Not checked while the context embeds its viewports (one system window: kittest, the web).
  2. PAINTS: a shown window painted something within the paint guard’s passes and delay (crate::paint_guard::DEFAULT_DELAY).
  3. OWNER: no window or popup without an owner.
  4. POPUP_PARENT: a popup’s parent exists.
  5. CHILD_ALIVE: a closed parent has no live child.
  6. ON_SCREEN: a positioned window meets a screen: a window whose position the system tells (not on Wayland, not minimized) overlaps one of the screens told (crate::window::set_screens), past the passes a move needs (crate::bus::ScreenRemoved moves those on a screen gone). Not checked while no screen is told.

CLOSED_LEFT is pop.window.close’s own: a window it closed is still in the registry once its listeners ran.

A broken rule is a visible state, never a silent fix: one error line naming the rule, the window, its owner and its state, one window.invariant event on the journal (rule, window, owner, state), and an entry in AppHandle::broken_invariants (the bus collector of the debug bridge shows them). It is said once, until it holds again (a line says so). Containment stays the paint guard’s (its fallback page, the hiding of a window that outlived its close). The test kit fails a test on one (egui_pop_test::windows::MultiWindow, the scenarios’ WindowInvariants).

Structs§

Broken
An invariant that did not hold.

Constants§

BACKEND
Rule 1: the registry’s windows are the backend’s viewports.
CHILD_ALIVE
Rule 5: a closed parent has no live child.
CLOSED_LEFT
pop.window.close’s check: the window it closed left the registry.
ON_SCREEN
Rule 6: a positioned window meets a screen.
OWNER
Rule 3: every window and popup has an owner.
PAINTS
Rule 2: a shown window paints something.
POPUP_PARENT
Rule 4: a popup’s parent exists.
RULES
The six rules, in the ADR’s order.