tear_off_sc_move_handshake

Function tear_off_sc_move_handshake 

Source
pub fn tear_off_sc_move_handshake(
    state: &Arc<AppState>,
    args: &Value,
) -> Result<Value, String>
Expand description

Tear-off Phase 2 — the Win32 SC_MOVE handshake.

Called from requestTearOff in tabbar.tsx AFTER the frontend has already (a) called WorkspaceService.TearOffTab to move the tab into a new workspace, and (b) called open_window_at_position to spawn the destination window. This handler waits for the destination window’s HWND to register, then issues the Win32 SC_MOVE so the new window enters the OS modal move-loop and follows the cursor at full opacity (no ghost) until mouseup.

Per spec §0 the cold-path version (no warm pool) accepts a ~150-300 ms first-paint flash for Phase 2 verification only; Phase 6 replaces that with a pre-warmed pool to hit the 0 ms target. The ≤ 8 ms handshake budget from §0 applies from this phase onward and is measured by tear_off.handshake_ms — excluded from the budget is only the registration-wait, which goes away with the warm pool.

See docs/specs/SPEC_TAB_TEAR_OFF_SIZE_PRESERVATION_2026_04_26.