Skip to main content

Module window_inherit

Module window_inherit 

Source
Expand description

window service handlers — MarkWindowOpen and InheritWindowAppearance: a new window opens with the theme and opacity of the window that created it (docs/specs/SPEC_PER_WINDOW_THEME_AND_OPACITY_2026_10_12.md §6).

The creator takes a mark (MarkWindowOpen), opens the window, learns its host label from that call’s return, and then calls InheritWindowAppearance with its own window id, the label and the mark. The new window’s renderer creates its Window row (CreateWindow) at about the same moment, so the two calls race. Each side first publishes what it has, then checks for the other: InheritWindowAppearance records a pending entry and then looks for the row; CreateWindow records its row and then takes any pending entry. Whichever side takes the entry applies it, so it is applied exactly once whatever the order.

Host labels are reused: a pool window can be demoted and promoted again straight away, and the old row can outlive that (its close runs on another thread). The mark is what tells the new row from the old one. Marks and row records share one counter, so a row created after the mark was taken is the one this open made; any older row for the label belongs to an earlier use of it and never takes the entry.

Structs§

Pending 🔒

Constants§

INHERITED_KEYS 🔒
The per-window appearance keys a new window copies from its creator.
PENDING_TTL 🔒
How long a pending entry waits for its window. A new window creates its row within a second or two of being opened.

Statics§

CREATED 🔒
host label → (the window id CreateWindow last made for it, its sequence, when).
PENDING 🔒
host label → the inheritance waiting for that label’s new row.
SEQ 🔒
Orders marks and row records: every mark and every recorded row gets the next value.

Functions§

appearance_patch 🔒
The source window’s appearance keys that are set, as a meta patch. None when the source is gone or has none of them set.
apply_inheritance 🔒
Copy source_window_id’s appearance onto target_window_id. Returns the events to publish; empty when there is nothing to copy.
handle_inherit_window_appearance 🔒
Args: sourceWindowId, hostLabel (the new window’s host label), mark (from MarkWindowOpen, taken before the window was opened).
handle_mark_window_open 🔒
No args. Returns a mark to pass to InheritWindowAppearance; take it before opening the window.
next_seq 🔒
record_created 🔒
Called by CreateWindow once the row exists, before it takes a pending entry. Returns the row’s sequence, for take_pending.
record_pending 🔒
take_pending 🔒
Take the pending source for label if a row with sequence row_seq is the one it waits for: recorded after its mark, and the entry still fresh.