zed/crates/image_viewer
Anthony Eid e39fb7c2e0
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_remote_server_linux_x86_64 (push) Blocked by required conditions
run_tests / check_remote_server_mac_aarch64 (push) Blocked by required conditions
run_tests / check_remote_server_windows_x86_64 (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
gpui: Rename ScrollWheelEvent to ScrollEvent and add trackpad scrolling on iOS (#65805)
Scrolling in GPUI comes from mouse wheels and trackpads reported by the
OS, and from touch pans that GPUI recognizes itself. All of them arrived
as `ScrollWheelEvent`, and handlers had no way to tell a finger pan from
anything else.

## API change

- `ScrollWheelEvent` → `ScrollEvent`, with a new `source: ScrollSource`
field.
- `ScrollSource` has two variants:
- `Pointer` (the default): a scroll the platform reported from a mouse
wheel or trackpad. `ScrollDelta::precise()` still tells continuous
devices apart from wheel notches.
- `Touch`: a finger pan recognized by GPUI, including its synthesized
momentum.
- `on_scroll_wheel` → `on_scroll`.
- `PlatformInput::ScrollWheel` → `PlatformInput::Scroll`.

### Compatibility

Existing app code keeps compiling: `ScrollWheelEvent` and
`on_scroll_wheel` remain as deprecated aliases. Two things still need
changes:
- Platform backends must switch to `PlatformInput::Scroll`. Rust can't
alias an enum variant.
- `ScrollEvent` literals that list every field must add `source`.
Literals using `..Default::default()` get `ScrollSource::Pointer`.

## Trackpad and mouse-wheel scrolling on iOS

`gpui_ios` previously handled only raw touches, so trackpads and mice on
iPad couldn't scroll. The backend now adds a `UIPanGestureRecognizer` to
the Metal view that accepts all scroll types and sends each step as a
`ScrollEvent` with the pointer position and modifiers.

The recognizer has an empty `allowedTouchTypes` and
`cancelsTouchesInView = false`. That way it never claims finger touches,
which keep going to `touchesBegan` and GPUI's touch recognizer.

UIKit ends these gestures when the fingers lift and leaves momentum to
the app. So for now a trackpad scroll on iOS stops when the fingers
lift, without the post-release glide that native views have.

## Verification

Done on Linux:
- `cargo test -p gpui --features test-support --lib -- gestures list::
scroll`: 72 passed.
- `./script/clippy -p gpui -p gpui_linux`: clean.
- `cargo clippy` for `gpui_ios` (`aarch64-apple-ios`) and `gpui_macos`
(`aarch64-apple-darwin`): clean.
- `cargo check -p gpui_web` (`wasm32-unknown-unknown`): clean.
- A temporary downstream-style test confirmed that code using
`ScrollWheelEvent` and `.on_scroll_wheel(...)` still compiles and
receives scrolls.

Not verified:
- **Windows:** wasn't type-checked locally, because `gpui`'s build
script needs the Windows resource compiler. CI covers it.
- **iOS behavior:** trackpad and wheel scrolling on an iPad hasn't been
tried. Specifically unconfirmed: scroll direction under natural
scrolling, and that finger pans don't also trigger the scroll
recognizer.

Release Notes:

- [GPUI] Renamed `ScrollWheelEvent` to `ScrollEvent` and
`on_scroll_wheel` to `on_scroll` (old names remain as deprecated
aliases), added `ScrollEvent::source` to distinguish pointer scrolling
from GPUI-recognized touch pans, and added trackpad and mouse-wheel
scrolling on iOS

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-20 01:13:50 +00:00
..
src gpui: Rename ScrollWheelEvent to ScrollEvent and add trackpad scrolling on iOS (#65805) 2026-10-20 01:13:50 +00:00
Cargo.toml Switch from cargo-machete to cargo-shear (#62643) 2026-08-20 10:08:48 +00:00
LICENSE-GPL