From e3f5744db42fe66453fb780a8d2412846849f45b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Oct 2022 12:14:00 -0700 Subject: [PATCH] Don't use XIWarpPointer() on multi-display configurations --- src/video/x11/SDL_x11mouse.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 3bf762d3f..04c5b8c47 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -317,7 +317,12 @@ WarpMouseInternal(Window xwindow, const int x, const int y) Display *display = videodata->display; #if SDL_VIDEO_DRIVER_X11_XINPUT2 int deviceid = 0; - X11_XIGetClientPointer(display, None, &deviceid); + /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: + * https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea + */ + if (SDL_GetNumVideoDisplays() == 1) { + X11_XIGetClientPointer(display, None, &deviceid); + } if (deviceid != 0) { X11_XIWarpPointer(display, deviceid, None, xwindow, 0.0, 0.0, 0, 0, (double)x, (double)y); } else