Problem
On X11, slave pointer device button events are dropped whenever the SDL window does not have keyboard focus. Remote-control tools (VNC, Sunflower, x11vnc) and automation tools inject clicks via virtual slave devices (XTEST/uinput); while the user is interacting with the remote machine, the local SDL window frequently does not hold keyboard focus, so every injected click is lost.
Root cause
src/video/x11/SDL_x11xinput2.c, in X11_HandleXinput2Event (XI_ButtonPress/XI_ButtonRelease handling):
if (SDL_GetMouseFocus() != windowdata->window || SDL_GetKeyboardFocus() != windowdata->window) {
break;
}
Commit ef9a5b704 added the keyboard-focus requirement to protect the click-through suppression logic ("a window must have keyboard focus to grab the mouse anyway"). But XInput2 slave button events follow the pointer focus, not the keyboard focus — a window can legitimately receive clicks while not holding keyboard focus (that is exactly how remote tools work), and requiring keyboard focus drops those events.
Suggested fix
Keep the mouse-focus check (that is what guards the grab/click-through case) and drop the keyboard-focus requirement:
if (SDL_GetMouseFocus() != windowdata->window) {
break;
}
Keyboard focus is still required where it actually matters (e.g. relative mouse motion is gated on SDL_GetKeyboardFocus() elsewhere in the same file).
Verification
- Run an SDL app, don't give it keyboard focus, inject a click via XTEST → click is lost without the fix, delivered with it.
- Grab/click-through behavior (the case
ef9a5b704 protected) still works — the mouse-focus check remains.
Problem
On X11, slave pointer device button events are dropped whenever the SDL window does not have keyboard focus. Remote-control tools (VNC, Sunflower, x11vnc) and automation tools inject clicks via virtual slave devices (XTEST/uinput); while the user is interacting with the remote machine, the local SDL window frequently does not hold keyboard focus, so every injected click is lost.
Root cause
src/video/x11/SDL_x11xinput2.c, inX11_HandleXinput2Event(XI_ButtonPress/XI_ButtonRelease handling):Commit
ef9a5b704added the keyboard-focus requirement to protect the click-through suppression logic ("a window must have keyboard focus to grab the mouse anyway"). But XInput2 slave button events follow the pointer focus, not the keyboard focus — a window can legitimately receive clicks while not holding keyboard focus (that is exactly how remote tools work), and requiring keyboard focus drops those events.Suggested fix
Keep the mouse-focus check (that is what guards the grab/click-through case) and drop the keyboard-focus requirement:
Keyboard focus is still required where it actually matters (e.g. relative mouse motion is gated on
SDL_GetKeyboardFocus()elsewhere in the same file).Verification
ef9a5b704protected) still works — the mouse-focus check remains.