From 5ba3d10471398c00c9f51a3ee6d2935ce5b625fe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 12 Mar 2026 18:41:20 +0530 Subject: [PATCH] X11: Fix a regression that caused some high res scroll devices to be treated as line based scroll devices Apparently when running under XWayland, we cant rely on libinput to detect highres scroll devices. Sigh. Linux input is such a disaster. Dunno if this will break something else, hopefully not. Fixes #9649 --- docs/changelog.rst | 2 ++ glfw/x11_window.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index bf0dfad8b..191aa50e3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -178,6 +178,8 @@ Detailed list of changes - Fix kitty hanging on startup on Intel macs (:iss:`9643`) +- X11: Fix a regression that caused some high res scroll devices to be treated as line based scroll devices (:iss:`9649`) + 0.46.0 [2026-03-11] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 31d44f44e..539ced065 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -29,6 +29,7 @@ #define _GNU_SOURCE #include "internal.h" +#include "math.h" #include "backend_utils.h" #include "linux_notify.h" #include "../kitty/monotonic.h" @@ -1446,7 +1447,7 @@ handle_xi_motion_event(_GLFWwindow *window, XIDeviceEvent *de) { *off = delta; if (!d->is_highres) { if (v->increment == 120.) type = GLFW_SCROLL_OFFEST_V120; - else { + else if (fabs(delta) >= fabs(v->increment)) { type = GLFW_SCROLL_OFFSET_LINES; if (v->increment != 0) *off /= v->increment; }