Module window

Module window 

Source
Expand description

Window lifecycle reducer handlers. Extracted from reducer/mod.rs in task #182 PR-C for navigability.

Handles ReportWindowOpened, ReportWindowClosed, and the ReportBackendWindowId{Registered,Unregistered} pair.

Functionsยง

handle_report_backend_window_id_registered ๐Ÿ”’
Phase B.5 (window_id_map step a) โ€” record the host-reported label โ†’ backend_window_id mapping. Idempotent on duplicate label (overwrites with the new ID and emits a fresh event so subscribers see the latest mapping).
handle_report_backend_window_id_unregistered ๐Ÿ”’
Phase B.5 (window_id_map step a) โ€” drop the host-reported label from the map. Strict pairing: emits BackendWindowIdUnregistered only when the label was present (mirrors WindowClosed and PoolWindowRemoved semantics โ€” codex P2 PR #577 round-2).
handle_report_window_closed ๐Ÿ”’
Phase B.4 โ€” drop a host-reported window from the mirror. Returns Event::WindowClosed only when the label was actually in the mirror; an unknown-label close is a silent no-op (codex P2 PR #577 round-2). Without this gate, a ReportWindowClosed for a label the launcher never saw (e.g. a pool window that was popped from the queue but failed HWND validation in promote_pool_window โ€” the orphan windowโ€™s eventual on_before_close reaches us without a matching open) would emit an unpaired WindowClosed broadcast and break subscribers that assume open/close pairing.
handle_report_window_opened ๐Ÿ”’
Phase B.4 โ€” record a host-reported window opening in the launcherโ€™s read-only mirror. Idempotent on duplicate opens (same label twice in a row): the second insert overwrites with fresh metadata and emits a fresh event. Subscribers must tolerate seeing the same label twice; cleaner once B.5 makes the launcher authoritative.