# gpui: Add long-press gesture recognition \(\#63561\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0855410ccd2040efbbf14d71409166b6c472e0bd)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0855410ccd2040efbbf14d71409166b6c472e0bd

Requested commit: 0855410ccd2040efbbf14d71409166b6c472e0bd

Commit: 0855410ccd2040efbbf14d71409166b6c472e0bd

Tree: 20bb28c1bec3a77b1151895f66dc6a1c83a84371

Author: Jakub Konka

Committer: GitHub

## Message

```
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 -- --check`
- `cargo 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
```

## Parents

- [d1446d66e080e536458d119b79ea81be44f6f837](https://git.cafe/gitcafe/zed/commit/d1446d66e080e536458d119b79ea81be44f6f837?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0855410ccd2040efbbf14d71409166b6c472e0bd?format=markdown)
