From 3d2b79c096afd26bd7dc1cd7763584a33b03dcda Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 5 Dec 2025 12:57:16 -0500
Subject: [PATCH] x11: Drop emulated pointer button events
Drop emulated pointer button events, as scroll valuators are handled natively, and SDL emulates mouse events from touch events on its own.
---
src/video/x11/SDL_x11xinput2.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 5d241617c3b01..18a60bd60e1a5 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -613,7 +613,7 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie)
} else {
SDL_SendPenButton(0, pen->pen, window, button - 1, down);
}
- } else {
+ } else if (!pointer_emulated) {
// Otherwise assume a regular mouse
SDL_WindowData *windowdata = xinput2_get_sdlwindowdata(videodata, xev->event);
int x_ticks = 0, y_ticks = 0;
@@ -627,12 +627,8 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie)
/* Discard wheel events from "Master" devices to avoid duplicates,
* as coarse wheel events are stateless and can't be deduplicated.
- *
- * If the pointer emulation flag is set on a wheel event, it is being
- * emulated from a scroll valuator, which will be handled natively.
*/
- if ((pointer_emulated || xev->deviceid != xev->sourceid) &&
- X11_IsWheelEvent(button, &x_ticks, &y_ticks)) {
+ if (xev->deviceid != xev->sourceid && X11_IsWheelEvent(button, &x_ticks, &y_ticks)) {
break;
}