Commit 818d9a12 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

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.
parent d47b13c4
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment