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,7 +1020,8 @@ 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 {
ElementState::Pressed => WindowEvent::MouseWheel {
device_id, device_id,
delta: match event.detail { delta: match event.detail {
4 => MouseScrollDelta::LineDelta(0.0, 1.0), 4 => MouseScrollDelta::LineDelta(0.0, 1.0),
@ -1031,6 +1032,8 @@ impl EventProcessor {
}, },
phase: TouchPhase::Moved, phase: TouchPhase::Moved,
}, },
ElementState::Released => return,
},
8 => WindowEvent::PointerButton { 8 => WindowEvent::PointerButton {
device_id, device_id,
primary: true, primary: true,

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.