input: Handle scroll events that only have amount_v120

X11, winit, and libei backends all can produce scroll events with
`amount_v120()` but no `amount()`.
This commit is contained in:
Ian Douglas Scott 2026-06-19 18:38:58 -07:00 • committed by Ian Douglas Scott
parent 18ae082615
commit 861b732671

View file

@ -968,7 +968,10 @@ impl State {
} }
} else { } else {
let mut frame = AxisFrame::new(event.time_msec()).source(event.source()); let mut frame = AxisFrame::new(event.time_msec()).source(event.source());
if let Some(horizontal_amount) = event.amount(Axis::Horizontal) { let horizontal_amount = event
.amount(Axis::Horizontal)
.or_else(|| Some(event.amount_v120(Axis::Horizontal)? * 15.0 / 120.));
if let Some(horizontal_amount) = horizontal_amount {
if horizontal_amount != 0.0 { if horizontal_amount != 0.0 {
frame = frame frame = frame
.relative_direction( .relative_direction(
@ -986,7 +989,10 @@ impl State {
frame = frame.stop(Axis::Horizontal); frame = frame.stop(Axis::Horizontal);
} }
} }
if let Some(vertical_amount) = event.amount(Axis::Vertical) { let vertical_amount = event
.amount(Axis::Vertical)
.or_else(|| Some(event.amount_v120(Axis::Vertical)? * 15.0 / 120.));
if let Some(vertical_amount) = vertical_amount {
if vertical_amount != 0.0 { if vertical_amount != 0.0 {
frame = frame frame = frame
.relative_direction( .relative_direction(