[PATCH v3 10/10] winex11.drv: Retry calling XGrabPointer later if it failed.

Rémi Bernon rbernon at codeweavers.com
Mon Oct 7 08:02:16 CDT 2019


Sometimes X11 refuses to grab the cursor. It is not reported to the
applications, and we don't even expect them to correctly handle these
situations. Instead, we should retry clipping the cursor later on until
it succeeds or until the application releases the cursor.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winex11.drv/mouse.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 9bc46332f20..2e23248fedf 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -425,6 +425,11 @@ static BOOL grab_clipping_window( const RECT *clip )
     {
         disable_xinput2();
         DestroyWindow( msg_hwnd );
+
+        /* we couldn't grab the cursor yet and we won't get notified when it
+         * is released, so we have to retry again a little bit later */
+        Sleep(100);
+        PostMessageW( GetForegroundWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 );
         return FALSE;
     }
     clip_rect = *clip;
--
2.23.0




More information about the wine-devel mailing list