gpui: Add mobile/touch API surface - #60496
Merged
Merged
Conversation
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.
Contributor
|
I wonder if we should gate this behind a cargo feature flag, like |
eholk
approved these changes
Jul 6, 2026
mikayla-maki
enabled auto-merge
July 11, 2026 22:04
This was referenced Jul 11, 2026
Closed
This was referenced Jul 31, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO:
Objective
Solution
Testing
Self-Review Checklist:
Release Notes: