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

Alexandre Julliard julliard at winehq.org
Tue Mar 23 15:07:41 CDT 2021


Module: wine
Branch: oldstable
Commit: fbcbfcb13a16a126a8ccee3d1cf9637effa2c881
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fbcbfcb13a16a126a8ccee3d1cf9637effa2c881

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>
(cherry picked from commit 432858b285d2b63eca6f99a162c9a13dd6e6ac71)
Signed-off-by: Michael Stefaniuc <mstefani 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 c8a5749a2f1..5e3ac1d374e 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -447,7 +447,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;
 }
 
@@ -467,7 +467,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