From 2b21c89e3cc39a37d42e29508defe3bd6a97d6fe Mon Sep 17 00:00:00 2001 From: Owen Law <81528246+someone13574@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:10:14 -0400 Subject: [PATCH] Fix XI2 Scrolling Issue (#12603) ref #11679 https://github.com/zed-industries/zed/pull/11235#issuecomment-2144727144 Filters leave events to ensure they are in the normal notify leave events (not grab or ungrab) ([spec](https://www.x.org/releases/X11R7.7/doc/inputproto/XI2proto.txt)). Confirmed to fix the issue @mrnugget was having. Release Notes: - linux: Fixed a regression that caused some X11 input devices being unable to scroll. --- crates/gpui/src/platform/linux/x11/client.rs | 2 +- crates/gpui/src/platform/linux/x11/window.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index ae06ec8cc7..36d1129574 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -766,7 +766,7 @@ impl X11Client { valuator_idx += 1; } } - Event::XinputLeave(event) => { + Event::XinputLeave(event) if event.mode == xinput::NotifyMode::NORMAL => { self.0.borrow_mut().scroll_x = None; // Set last scroll to `None` so that a large delta isn't created if scrolling is done outside the window (the valuator is global) self.0.borrow_mut().scroll_y = None; diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index bc4fb0212c..d5c1846d56 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -261,8 +261,6 @@ impl X11WindowState { .event_mask( xproto::EventMask::EXPOSURE | xproto::EventMask::STRUCTURE_NOTIFY - | xproto::EventMask::ENTER_WINDOW - | xproto::EventMask::LEAVE_WINDOW | xproto::EventMask::FOCUS_CHANGE | xproto::EventMask::KEY_PRESS | xproto::EventMask::KEY_RELEASE,