SDL: x11: don't send raw mouse motion when the application doesn't have focus

https://github.com/libsdl-org/SDL/commit/f0cd3ed3303bf4731e6c30f975b8a2833c4fd687

From f0cd3ed3303bf4731e6c30f975b8a2833c4fd687 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 26 Mar 2024 13:10:54 -0700
Subject: [PATCH] x11: don't send raw mouse motion when the application doesn't
 have focus

---
 src/video/x11/SDL_x11xinput2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index a8160f824eed7..a80f4361bbcaf 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -350,6 +350,11 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie)
             break;
         }
 
+        /* Relative mouse motion is delivered to the window with keyboard focus */
+        if (!SDL_GetKeyboardFocus()) {
+            break;
+        }
+
         devinfo = xinput2_get_device_info(videodata, rawev->deviceid);
         if (!devinfo) {
             break; /* oh well. */