Files
winit/src/platform_impl/linux/wayland/seat/pointer/scroll.rs
T
tomasmark79andBrandon Thomas 5506b1a95e W13: Wayland: pixel-only wheel, wheel-tilt and continuous scrolls report Moved
Use the reported axis source so wheel, wheel-tilt and continuous-source scroll events report
`TouchPhase::Moved` instead of starting a finger gesture that never ends; egui then follows modifier
release instead of keeping Ctrl zoom latched. Finger momentum is unchanged. The phase policy lives
in `seat/pointer/scroll.rs`. Taken from storytold/pdfcraft vendor/winit patch (13)
(storytold/pdfcraft#1569). No upstream winit PR yet.

Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-21 18:16:39 +02:00

22 lines
952 B
Rust

//! PdfCraft patch (13): Wayland scroll-phase policy, shared with the desktop regression tests.
use wayland_client::protocol::wl_pointer::AxisSource;
use crate::event::TouchPhase;
pub(crate) fn phase(previous: TouchPhase, source: Option<AxisSource>, has_discrete_scroll: bool, stopped: bool) -> TouchPhase {
// Wayland does not guarantee axis_stop for these sources. A pixel-only wheel must
// not start a finger gesture: consumers would retain its modifiers indefinitely.
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer-event-axis_source
if stopped {
TouchPhase::Ended
} else if has_discrete_scroll || matches!(source, Some(AxisSource::Wheel | AxisSource::WheelTilt | AxisSource::Continuous)) {
TouchPhase::Moved
} else {
match previous {
TouchPhase::Started | TouchPhase::Moved => TouchPhase::Moved,
_ => TouchPhase::Started,
}
}
}