x11: ignore mouse scroll button release events

This commit is contained in:
Pavel Strakhov 2025-10-24 12:07:10 +01:00 committed by GitHub
parent 1e7ab0cd25
commit 03dad26c43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View file

@ -1020,16 +1020,19 @@ impl EventProcessor {
// those. In practice, even clicky scroll wheels appear to be reported by // those. In practice, even clicky scroll wheels appear to be reported by
// evdev (and XInput2 in turn) as axis motion, so we don't otherwise // evdev (and XInput2 in turn) as axis motion, so we don't otherwise
// special-case these button presses. // special-case these button presses.
4..=7 => WindowEvent::MouseWheel { 4..=7 => match state {
device_id, ElementState::Pressed => WindowEvent::MouseWheel {
delta: match event.detail { device_id,
4 => MouseScrollDelta::LineDelta(0.0, 1.0), delta: match event.detail {
5 => MouseScrollDelta::LineDelta(0.0, -1.0), 4 => MouseScrollDelta::LineDelta(0.0, 1.0),
6 => MouseScrollDelta::LineDelta(1.0, 0.0), 5 => MouseScrollDelta::LineDelta(0.0, -1.0),
7 => MouseScrollDelta::LineDelta(-1.0, 0.0), 6 => MouseScrollDelta::LineDelta(1.0, 0.0),
_ => unreachable!(), 7 => MouseScrollDelta::LineDelta(-1.0, 0.0),
_ => unreachable!(),
},
phase: TouchPhase::Moved,
}, },
phase: TouchPhase::Moved, ElementState::Released => return,
}, },
8 => WindowEvent::PointerButton { 8 => WindowEvent::PointerButton {
device_id, device_id,

View file

@ -269,3 +269,4 @@ changelog entry.
- On Windows 11, prevent incorrect shifting when dragging window onto a monitor with different DPI. - On Windows 11, prevent incorrect shifting when dragging window onto a monitor with different DPI.
- On Web, device events are emitted regardless of cursor type. - On Web, device events are emitted regardless of cursor type.
- On Wayland, `axis_value120` scroll events now generate `MouseScrollDelta::LineDelta` - On Wayland, `axis_value120` scroll events now generate `MouseScrollDelta::LineDelta`
- On X11, mouse scroll button events no longer cause duplicated `WindowEvent::MouseWheel` events.