Skip to content

Commit e8172fc

Browse files
zzhiyiivyl
authored andcommitted
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 bb496ea, 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. (cherry picked from commit 818d9a1) CW-Bug-Id: #23531
1 parent 1e2448a commit e8172fc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

dlls/user32/tests/win.c

-2
Original file line numberDiff line numberDiff line change
@@ -13112,7 +13112,6 @@ static void test_ReleaseCapture(void)
1311213112
ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError());
1311313113
flush_events(TRUE);
1311413114
do_release_capture = FALSE;
13115-
todo_wine
1311613115
ok(wm_mousemove_count < 10, "Got too many WM_MOUSEMOVE.\n");
1311713116

1311813117
/* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */
@@ -13128,7 +13127,6 @@ static void test_ReleaseCapture(void)
1312813127
ret = ReleaseCapture();
1312913128
ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError());
1313013129
flush_events(TRUE);
13131-
todo_wine
1313213130
ok(wm_mousemove_count == 0, "Got WM_MOUSEMOVE.\n");
1313313131

1313413132
ret = SetCursorPos(pt.x, pt.y);

dlls/win32u/input.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -1803,10 +1803,13 @@ HWND WINAPI NtUserSetCapture( HWND hwnd )
18031803
*/
18041804
BOOL release_capture(void)
18051805
{
1806-
BOOL ret = set_capture_window( 0, 0, NULL );
1806+
HWND previous = NULL;
1807+
BOOL ret;
1808+
1809+
ret = set_capture_window( 0, 0, &previous );
18071810

18081811
/* Somebody may have missed some mouse movements */
1809-
if (ret)
1812+
if (ret && previous)
18101813
{
18111814
INPUT input = { .type = INPUT_MOUSE };
18121815
input.mi.dwFlags = MOUSEEVENTF_MOVE;

0 commit comments

Comments
 (0)