handle_report_window_opened

Function handle_report_window_opened 

Source
pub(super) fn handle_report_window_opened(
    state: &mut State,
    ctx: &Ctx,
    label: String,
    kind: WindowKind,
    parent_label: Option<String>,
) -> Vec<Event>
Expand description

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.

Phase B.5: also assigns an authoritative instance number from state.instance_registry and emits WindowInstanceAssigned. “main” is pre-seeded with 1; other labels get the next value of next_instance_num. Re-opens of an existing label preserve the original number — instance numbers are stable per-label-per-run.