mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Fix evdev emulated scroll events
When X's evdev input module is configured to emulate scroll events (as used with e.g. trackpoints), it generates non-emulated scroll button presses and does not generate motion events. This is contrary to the behavior of all other hardware I've tested, and contrary to the behavior of libinput, but nonetheless should be supported.
This commit is contained in:
parent
45c5568c89
commit
c508d68d1d
|
@ -370,7 +370,19 @@ impl EventsLoop {
|
|||
// Suppress emulated scroll wheel clicks, since we handle the real motion events for 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 special-case these button presses.
|
||||
4 | 5 | 6 | 7 if xev.flags & ffi::XIPointerEmulated != 0 => {}
|
||||
4 | 5 | 6 | 7 => if xev.flags & ffi::XIPointerEmulated == 0 {
|
||||
callback(Event::WindowEvent { window_id: wid, event: MouseWheel {
|
||||
device_id: did,
|
||||
delta: match xev.detail {
|
||||
4 => LineDelta(0.0, 1.0),
|
||||
5 => LineDelta(0.0, -1.0),
|
||||
6 => LineDelta(-1.0, 0.0),
|
||||
7 => LineDelta(1.0, 0.0),
|
||||
_ => unreachable!()
|
||||
},
|
||||
phase: TouchPhase::Moved,
|
||||
}});
|
||||
},
|
||||
|
||||
x => callback(Event::WindowEvent { window_id: wid, event: MouseInput { device_id: did, state: state, button: Other(x as u8) } })
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue