From bc3264130d3e2fd21f471d0f6aaccbe6c9828171 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 31 Jan 2025 23:45:09 -0800
Subject: [PATCH] Fixed mouse motion events while the mouse is grabbed
When the mouse is grabbed, the X server sends mouse events only to the grabbing client, and XInput2 events for the master device are not delivered.
We should consider using the window mouse rect confinement instead of a true X server grab for SDL mouse grab functionality.
---
src/video/x11/SDL_x11events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index aebed3ef0710c..7bca58b373c3e 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -1614,7 +1614,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case MotionNotify:
{
- if (data->xinput2_mouse_enabled) {
+ if (data->xinput2_mouse_enabled && !data->mouse_grabbed) {
// This input is being handled by XInput2
break;
}