Module: wine Branch: master Commit: 818d9a12100bfa6e574e88cd1567985b5884d002 URL: https://gitlab.winehq.org/wine/wine/-/commit/818d9a12100bfa6e574e88cd1567985...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Fri Mar 8 16:38:16 2024 +0800
win32u: Only send mouse input in ReleaseCapture() when a window is captured.
Fix a regression from "bb496ea8 - server: Always queue mouse messages delivered to another window."
Fix ETHER VAPOR Remaster (214570) launches to black screen when the cursor is in the game window.
The game calls ReleaseCapture() when handling WM_MOUSEMOVE. After bb496ea8, WM_MOUSEMOVE is always queued because the message window is NULL. So ReleaseCapture() ends up queuing another WM_MOUSEMOVE. So the game ends up handling infinite WM_MOUSEMOVE messages at startup and is not able to do anything.
---
dlls/user32/tests/win.c | 2 -- dlls/win32u/input.c | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index c1c2cc52059..775164e3e9f 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13115,7 +13115,6 @@ static void test_ReleaseCapture(void) ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); flush_events(TRUE); do_release_capture = FALSE; - todo_wine ok(wm_mousemove_count < 10, "Got too many WM_MOUSEMOVE.\n");
/* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */ @@ -13131,7 +13130,6 @@ static void test_ReleaseCapture(void) ret = ReleaseCapture(); ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); flush_events(TRUE); - todo_wine ok(wm_mousemove_count == 0, "Got WM_MOUSEMOVE.\n");
ret = SetCursorPos(pt.x, pt.y); diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 0f6b9482942..4a7c04f66c5 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1770,10 +1770,13 @@ HWND WINAPI NtUserSetCapture( HWND hwnd ) */ BOOL release_capture(void) { - BOOL ret = set_capture_window( 0, 0, NULL ); + HWND previous = NULL; + BOOL ret; + + ret = set_capture_window( 0, 0, &previous );
/* Somebody may have missed some mouse movements */ - if (ret) + if (ret && previous) { INPUT input = { .type = INPUT_MOUSE }; input.mi.dwFlags = MOUSEEVENTF_MOVE;