Ignore master pointer device events since we use the slave devices

This commit is contained in:
Kovid Goyal 2026-01-11 12:57:56 +05:30
parent 1efded85bc
commit da170555fa
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 8 additions and 4 deletions

1
glfw/x11_init.c vendored
View file

@ -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;

1
glfw/x11_platform.h vendored
View file

@ -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;

10
glfw/x11_window.c vendored
View file

@ -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)