diff --git a/CHANGELOG.md b/CHANGELOG.md index c998563b..d7e485bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - `Icon::to_cardinals` is no longer public, since it was never supposed to be. - Wayland: improve diagnostics if initialization fails - Fix some system event key doesn't work when focused, do not block keyevent forward to system on macOS +- On X11, the scroll wheel position is now correctly reset on i3 and other WMs that have the same quirk. # Version 0.14.0 (2018-05-09) diff --git a/src/platform/linux/x11/mod.rs b/src/platform/linux/x11/mod.rs index b0422a18..b3a15084 100644 --- a/src/platform/linux/x11/mod.rs +++ b/src/platform/linux/x11/mod.rs @@ -804,15 +804,19 @@ impl EventsLoop { let window_id = mkwid(xev.event); let device_id = mkdid(xev.deviceid); - let mut devices = self.devices.borrow_mut(); - let physical_device = match devices.get_mut(&DeviceId(xev.sourceid)) { - Some(device) => device, - None => return, - }; if let Some(all_info) = DeviceInfo::get(&self.display, ffi::XIAllDevices) { + let mut devices = self.devices.borrow_mut(); for device_info in all_info.iter() { - if device_info.deviceid == xev.sourceid { - physical_device.reset_scroll_position(device_info); + if device_info.deviceid == xev.sourceid + // This is needed for resetting to work correctly on i3, and + // presumably some other WMs. On those, `XI_Enter` doesn't include + // the physical device ID, so both `sourceid` and `deviceid` are + // the virtual device. + || device_info.attachment == xev.sourceid { + let device_id = DeviceId(device_info.deviceid); + if let Some(device) = devices.get_mut(&device_id) { + device.reset_scroll_position(device_info); + } } } }