Skip to content

gpui: Add mobile/touch API surface - #60496

Merged
mikayla-maki merged 4 commits into
mainfrom
gpui-mobile-api
Jul 11, 2026
Merged

gpui: Add mobile/touch API surface#60496
mikayla-maki merged 4 commits into
mainfrom
gpui-mobile-api

Conversation

@mikayla-maki

@mikayla-maki mikayla-maki commented Jul 6, 2026

Copy link
Copy Markdown
Member

TODO:

  • Remove slop comments
  • Review APIs in detail

Objective

  • This PR aims to add official mobile API surfaces to GPUI

Solution

  • This PR cross references several internal experiments to come up with a general cross-platform abstraction for core input mechanisms, but defers actual implementations to later. These are intended to be a common base to build off of.

Testing

  • Yes, as mentioned above with external experiments

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • N/A

Types and trait methods only, no dispatch machinery and no platform
implementations; every trait method defaults to a no-op so desktop
platforms compile unchanged. The contract for each addition lives in its
rustdoc, including per-method iOS/Android source mappings.

- Raw touch input: TouchId, TouchEvent, PlatformInput::Touch, and
  TouchPhase::Cancelled (system-stolen touches). Touch dispatch is
  specified as fully separate from mouse: no synthesized mouse events,
  no mouse_position/hover/cursor updates, implicit capture at Started
  keyed on stable element identity (implementation pending).
- InputModality::Touch so touch input participates in focus-visible
  and hover-suppression styling.
- Gesture vocabulary: GestureTuning (feel constants), GestureKinds,
  LongPressEvent, ClickEvent::Touch(TouchClickEvent) so on_click works
  untouched on mobile, and the PlatformGestures trait: a third platform
  layer letting platforms recognize gestures natively (e.g. UIKit
  recognizers) while gpui core's future arena owns arbitration.
- Window geometry: WindowInsets { safe_area, ime } with per-edge max
  combination; insets are data, avoidance is policy. resize remains a
  separate, real channel.
- App lifecycle: AppLifecyclePhase (Active/Inactive/Background/
  Foreground, focus distinct from visibility), on_memory_warning, and
  a declare-ahead back handler matching Android's OnBackInvokedCallback
  contract.
- Text input: set_selected_text_range (platform-to-app selection, for
  UITextInput/InputConnection), element_bounds (pull-based IME geometry
  alongside macOS's update_ime_position push), text_length_utf16, the
  TextInputStateChange push signals (focus/selection/content) and
  show/hide_soft_keyboard.

Exhaustive-match fallout: terminal treats TouchPhase::Cancelled as a
non-committing end; editor runnables treat taps as quick-launch.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 6, 2026
@mikayla-maki
mikayla-maki requested review from agu-z and eholk July 6, 2026 20:14
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jul 6, 2026
@eholk

eholk commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

I wonder if we should gate this behind a cargo feature flag, like exp-mobile or something like that?

@mikayla-maki mikayla-maki self-assigned this Jul 10, 2026
@mikayla-maki
mikayla-maki enabled auto-merge July 11, 2026 22:04
@mikayla-maki
mikayla-maki added this pull request to the merge queue Jul 11, 2026
Merged via the queue into main with commit 9c32732 Jul 11, 2026
33 checks passed
@mikayla-maki
mikayla-maki deleted the gpui-mobile-api branch July 11, 2026 22:17
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
TODO:

- [ ] Remove slop comments
- [ ] Review APIs in detail

# Objective

- This PR aims to add official mobile API surfaces to GPUI

## Solution

- This PR cross references several internal experiments to come up with
a general cross-platform abstraction for core input mechanisms, but
defers actual implementations to later. These are intended to be a
common base to build off of.

## Testing

- Yes, as mentioned above with external experiments

## Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
TODO:

- [ ] Remove slop comments
- [ ] Review APIs in detail

# Objective

- This PR aims to add official mobile API surfaces to GPUI

## Solution

- This PR cross references several internal experiments to come up with
a general cross-platform abstraction for core input mechanisms, but
defers actual implementations to later. These are intended to be a
common base to build off of.

## Testing

- Yes, as mentioned above with external experiments

## Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants