Rémi Bernon : winex11.drv: Don't wait for the desktop thread to store clipping window.

Alexandre Julliard julliard at winehq.org
Fri Sep 4 15:47:33 CDT 2020


Module: wine
Branch: master
Commit: 432858b285d2b63eca6f99a162c9a13dd6e6ac71
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=432858b285d2b63eca6f99a162c9a13dd6e6ac71

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Sep  4 00:57:32 2020 +0200

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

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 eb5e6a6c0d..68e24a320a 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 );
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list