collab-staging: gpui: Add long-press gesture recognition (#63561)
GPUI's touch gesture recognizer handles taps and pans, but its
long-press event was only a placeholder. Applications therefore could
not distinguish a deliberate press-and-hold from a tap or scroll using
the portable touch path.
This adds deadline-driven long-press recognition and dispatches a phased
event stream through GPUI's existing capture and bubble listener path. A
listener claims the gesture by preventing the initial event's default
behavior and capturing it for an entity. Unclaimed gestures remain
eligible for the existing tap and pan behaviors, while claimed gestures
receive movement and termination events without also producing taps or
scrolling.
The timer is cancelled when the pending gesture resolves. gpui_web now
translates reusable browser pointer identifiers into touch identifiers
that remain unique for each touch lifetime, preventing an old timer from
acting on a newer touch. Native macOS trackpad scrolling remains on its
existing ScrollWheelEvent path and does not enter touch gesture
recognition.
Testing performed:
cargo fmt --all -- --checkcargo nextest run -p gpui --lib long_press(10 passed)RUSTC_BOOTSTRAP=1 cargo check -p gpui_web --target wasm32-unknown-unknown
Release Notes:
- N/A