From 8c00428ee45664c3e0ed438a10a62ae10aa8d402 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 2 Mar 2024 14:10:14 -0800 Subject: [PATCH] bugfix(x11): fix incorrect delta filtering Invert the mouse delta filter, so it aligns with the intention of filtering values lower than epsilon. Signed-off-by: John Nunley Closes: https://github.com/rust-windowing/winit/issues/3558 --- CHANGELOG.md | 1 + src/platform_impl/linux/x11/util/mouse.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f21e8488..7ac0f45b5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Unreleased` header. - **Breaking:** Removed `EventLoopBuilder::with_user_event`, the functionality is now available in `EventLoop::with_user_event`. - Add `Window::default_attributes` to get default `WindowAttributes`. - `log` has been replaced with `tracing`. The old behavior can be emulated by setting the `log` feature on the `tracing` crate. +- On X11, fix a bug where some mouse events would be unexpectedly filtered out. # 0.29.13 diff --git a/src/platform_impl/linux/x11/util/mouse.rs b/src/platform_impl/linux/x11/util/mouse.rs index 212ea57267..9f22266da3 100644 --- a/src/platform_impl/linux/x11/util/mouse.rs +++ b/src/platform_impl/linux/x11/util/mouse.rs @@ -30,8 +30,8 @@ macro_rules! consume { let this = $this; let (x, y) = match (this.x.abs() < <$ty>::EPSILON, this.y.abs() < <$ty>::EPSILON) { (true, true) => return None, - (true, false) => (this.x, 0.0), - (false, true) => (0.0, this.y), + (false, true) => (this.x, 0.0), + (true, false) => (0.0, this.y), (false, false) => (this.x, this.y), };