[PATCH] winex11.drv: Add a delay on FocusIn/NotifyUngrab before grabbing the cursor.

Rémi Bernon rbernon at codeweavers.com
Wed Sep 18 07:42:44 CDT 2019


Since 92177b0b161e91f1d609615d89d8e3199feea33f we retry grabbing the
cursor with the last clipping rectangle as soon as the WM releases the
keyboard. However it sometimes messes up with the Shell that expects
to be able to grab the cursor before opening activity view.

Without this, it can be hard to trigger the GNOME Shell activity view
by pressing the Super key while a Wine window is active.

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

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index f79f40c2323..9c6bf5c10bf 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -787,6 +787,11 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
         keyboard_grabbed = FALSE;
         break;
     case NotifyUngrab:
+        /* hack: wait a bit before trying to grab the cursor, the wm might have released the grab
+         * for the Shell - gnome-shell or similar - to take it, and we shouldn't get in their way.
+         */
+        Sleep(100);
+
         keyboard_grabbed = FALSE;
         retry_grab_clipping_window();
         return TRUE; /* ignore wm specific NotifyUngrab / NotifyGrab events w.r.t focus */
--
2.23.0




More information about the wine-devel mailing list