1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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.
This commit is contained in:
Zhiyi Zhang 2024-03-08 16:38:16 +08:00 committed by Alexandre Julliard
parent d47b13c45a
commit 818d9a1210
2 changed files with 5 additions and 4 deletions

View file

@ -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);

View file

@ -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;