[PATCH] winex11.drv: Don't wait for the desktop thread to store clipping window.

Rémi Bernon rbernon at codeweavers.com
Thu Sep 3 17:57:32 CDT 2020


The messages are in flight, the state will be updated eventually in
the order they are received by the desktop thread, we shouldn't have
to wait. If the clipping window gets overwritten, it will also receive
a message from the desktop thread, which is sent asynchronously already.

Call of Duty: WWII calls ClipCursor in a loop on startup while the
foreground thread is stalled and the messages sometimes pile up. The
recursive message processing that SendMessageW induces can then cause
stack overflows.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49643
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winex11.drv/mouse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index eb5e6a6c0d4..68e24a320af 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -445,7 +445,7 @@ static BOOL grab_clipping_window( const RECT *clip )
     if (!data->clip_hwnd) sync_window_cursor( clip_window );
     InterlockedExchangePointer( (void **)&cursor_window, msg_hwnd );
     data->clip_hwnd = msg_hwnd;
-    SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
+    SendNotifyMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
     return TRUE;
 }
 
@@ -465,7 +465,7 @@ void ungrab_clipping_window(void)
     XUnmapWindow( display, clip_window );
     if (clipping_cursor) XUngrabPointer( display, CurrentTime );
     clipping_cursor = FALSE;
-    SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 );
+    SendNotifyMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 );
 }
 
 /***********************************************************************
-- 
2.28.0




More information about the wine-devel mailing list