From da170555fac1efb4845d4b607df6a6beb62eaee1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Jan 2026 12:57:56 +0530 Subject: [PATCH] Ignore master pointer device events since we use the slave devices --- glfw/x11_init.c | 1 + glfw/x11_platform.h | 1 + glfw/x11_window.c | 10 ++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 69de72413..aeddebcb9 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -160,6 +160,7 @@ read_xi_scroll_devices(void) { if (!devices) return; for (int i = 0; i < deviceCount; i++) { XIDeviceInfo* device = &devices[i]; + if (device->use == XIMasterPointer) _glfw.x11.xi.master_pointer_id = device->deviceid; if (device->use != XISlavePointer || !device->enabled) continue; Atom actual_type; int actual_format; diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index d1a6e2172..5f523fceb 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -425,6 +425,7 @@ typedef struct _GLFWlibraryX11 PFN_XIGetProperty GetProperty; XIScrollDevice scroll_devices[16]; unsigned num_scroll_devices; + int master_pointer_id; Atom LIBINPUT_SCROLL_METHOD_ENABLED; } xi; diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 2736b160c..dd040674f 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -1407,10 +1407,12 @@ static void processEvent(XEvent *event) else if (event->xcookie.evtype == XI_Motion) { XIDeviceEvent* de = (XIDeviceEvent*)event->xcookie.data; - // Find the window for this event - _GLFWwindow* window = NULL; - if (XFindContext(_glfw.x11.display, de->event, _glfw.x11.context, (XPointer*)&window) == 0) - handle_xi_motion_event(window, de); + if (de->deviceid != _glfw.x11.xi.master_pointer_id) { + // Find the window for this event + _GLFWwindow* window = NULL; + if (XFindContext(_glfw.x11.display, de->event, _glfw.x11.context, (XPointer*)&window) == 0) + handle_xi_motion_event(window, de); + } } // Handle XI_HierarchyChanged for device hotplug else if (event->xcookie.evtype == XI_HierarchyChanged)