[PATCH] winex11.drv: Don't confine the pointer to any window when just checking for active grab.

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Jan 15 06:21:36 CST 2020

Fixes a regression introduced by 74efb3e872aebf57a42d62b52e149ae26f320c9a,
which caused some random pointer warping on a setup with multiple "workspaces"
when switching between them and a full screen game that warped the mouse.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>

As I understand, that commit was supposed to just check for a pointer grab,
and temporarily "lock it" if it was free, while the pointer is warped via
XWarpPointer. There's no need to confine it to root_window in this case,
which causes issues with multiple workspaces apparently.

It's not easy to reproduce reliably, but an example game to reproduce this
with is SpellForce. Place the game in a Virtual Desktop that covers the
entire screen on a different workspace (say, to the right of the current
one). When entering a map, move the mouse in game to the left so it moves
the map view. While this happens, quickly switch to the left workspace
(with shortcuts), then the pointer will at seemingly random times warp to
the right edge of the screen while you are in the new workspace (because
the game's workspace is to the right).

This patch, however, fixes that issue and many others that are hard to
reproduce reliably, while switching workspaces from a fullscreen game.

 dlls/winex11.drv/mouse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 290732f..7f0edd9 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -1478,7 +1478,7 @@ BOOL CDECL X11DRV_SetCursorPos( INT x, INT y )
     if (!clipping_cursor &&
         XGrabPointer( data->display, root_window, False,
                       PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
-                      GrabModeAsync, GrabModeAsync, root_window, None, CurrentTime ) != GrabSuccess)
+                      GrabModeAsync, GrabModeAsync, None, None, CurrentTime ) != GrabSuccess)
         WARN( "refusing to warp pointer to %u, %u without exclusive grab\n", pos.x, pos.y );
         return FALSE;

More information about the wine-devel mailing list