Module wrr

Module wrr 

Source

Modules§

rect

Enums§

HwndOpenedOutcome 🔒
Internal — the four branches of apply_hwnd_opened against a known label_hint. Lifted into its own enum so the function can drop the &mut WindowMirror borrow before calling state.bump_version() on the drift-emitting path (rustc E0499).

Constants§

HIDDEN_SINCE_OPEN_GRACE_MS 🔒
Placement grace window. CEF creates top-level windows hidden, runs SetWindowPos to place them, then shows them. The intermediate WM_HIDE events arrive before WM_FOREGROUND, which would otherwise look like HiddenSinceOpen drift on every fresh window. Hides occurring within this window of the host’s ReportWindowOpened are part of normal placement and don’t count.

Functions§

apply_hwnd_destroyed
Phase B.9.1 — handle Command::ReportHwndDestroyed. Three outcomes:
apply_hwnd_foreground_changed
Phase B.9.1 — handle Command::ReportHwndForegroundChanged. Updates the “has been seen” flag. Never emits drift directly — its role is to suppress future HiddenSinceOpen emissions.
apply_hwnd_iconic_changed
Phase B.9.1 — handle Command::ReportHwndIconicChanged. Updates state. No drift directly — operator can read steady state via --diag wrr (B.9.2) if they want to see who’s minimized.
apply_hwnd_opened
Phase B.9.1 — handle Command::ReportHwndOpened. Either:
apply_hwnd_position_changed
Phase B.9.1 — handle Command::ReportHwndPositionChanged. Compares the new rect against state.monitors; emits OffMonitor drift if it doesn’t intersect any monitor. Suppressed when state.monitors is empty (we don’t yet know the topology — first ReportMonitorTopologyChanged will reconcile every label’s last_rect against fresh monitors).
apply_hwnd_visibility_changed
Phase B.9.1 — handle Command::ReportHwndVisibilityChanged. Drift fires only on visible=false for a known label that has not been foregrounded since open AND is past the post-open placement grace window.
apply_monitor_topology_changed
Phase B.9.1 — handle Command::ReportMonitorTopologyChanged. Replaces state.monitors wholesale, then re-evaluates every known mirror’s last_rect against the new set. Emits OffMonitor for any window that newly falls off (e.g. user unplugged the external display where the window lived).
drain_deferred_hidden_since_open
Sweep hidden_since_open_deferred mirrors and emit drift for any that have crossed the placement grace boundary while still hidden and never foregrounded. Called from reducer::update AFTER every command processes so any recovery event the command itself dispatched (visible=true / foreground change / window closed) has a chance to clear the deferred state first. Without the AFTER ordering, a slow placement whose first post-grace event is the recovery itself would fire a spurious drift before the recovery runs (codex P2 PR #725 round 2).
is_win32_hidden_sentinel 🔒
Phase B.9.1 — Win32 sentinel positions for “this window is hidden.” CEF parks new windows here briefly between create and first paint; same value family (SW_HIDE analog used by ITaskbarList::DeleteTab removed windows). We suppress drift emission for these but DO trigger corrective move (the user shouldn’t see the sentinel).
pick_primary_centered 🔒
Phase B.9.2 — pick a corrective target rect: centered on the first monitor at a sensible default size (1280x800 or 70% of monitor, whichever is smaller). None if the monitor list is empty (caller suppresses corrective in that case).
severity_for
Phase B.9.1 — per-kind severity classifier. The split is deliberate: OrphanDestroy and HwndWithoutBrowser indicate a real divergence between CEF identity and Win32 reality (a CEF bug or a missed report path) — ERROR. OffMonitor, HiddenSinceOpen, LingeringHwnd are operationally significant (user can’t see / use the window) but don’t indicate a state-machine bug — WARN. BrowserWithoutHwnd is commonly transient (race window between OS create and host link) — INFO; only meaningful if it doesn’t reconcile.