Browse Source

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

Sam Lantinga 1 year ago
parent
commit
f0cd3ed330
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/video/x11/SDL_x11xinput2.c

+ 5 - 0
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. */