Phase B.9.1 โ handle to host AppState for the static
SetWinEventHook callback (the OS API takes a fixed-shape
extern "system" fn, so AppState has to be reachable through
a static). Set once by install_hooks(state). The callback
reads pending_window_creations to supply label_hint on
EVENT_OBJECT_CREATE, eliminating the launcher-side
โpending HWND with no matching mirrorโ race.
Phase B.9.1 โ initial monitor enumeration. Called once from
install_hooks. Mid-session topology changes (a follow-up
concern for B.9.2) would re-enumerate via WM_DISPLAYCHANGE.
Phase B.9.1 โ handles to the installed hooks. Held in a
OnceLock<Mutex<Option<...>>> so install_hooks is idempotent
(no-op on second call) and uninstall can drop them on shutdown.
Phase B.9.1 โ install the WRR hooks. Idempotent (logs and
returns if hooks are already installed). Must be called from a
thread that owns a Win32 message pump โ the hostโs CEF UI
thread does, so we install from there at startup.
Read the windowโs screen-coordinate rectangle. None if the
API call fails (window torn down between our event and the
read โ common during destroy).
Phase B.9.1 โ hook callback. Runs OUT-OF-CONTEXT (on the
hooking thread, posted via the message pump). Must not block
for long: we only do quick HWND-property reads and dispatch
non-blocking sync IPC reports.