Module win_event

Module win_event 

Source

Structsยง

HookHandle ๐Ÿ”’

Functionsยง

app_state ๐Ÿ”’
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.
enumerate_monitors ๐Ÿ”’
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.
hook_handles ๐Ÿ”’
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.
install_hooks
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.
install_one ๐Ÿ”’
read_class_name ๐Ÿ”’ โš 
Read the Win32 class name into an owned String.
read_window_rect ๐Ÿ”’ โš 
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).
read_window_text ๐Ÿ”’ โš 
Read the windowโ€™s text (title) into an owned String. Empty string if no title.
uninstall_hooks
Phase B.9.1 โ€” uninstall the hooks. Called from host shutdown.
win_event_callback ๐Ÿ”’ โš 
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.