diff --git a/dlls/user/input.c b/dlls/user/input.c index 549c37f5a94..9177d1535dc 100644 --- a/dlls/user/input.c +++ b/dlls/user/input.c @@ -183,7 +183,19 @@ HWND WINAPI SetCapture( HWND hwnd ) */ BOOL WINAPI ReleaseCapture(void) { - return (SetCapture(0) != 0); + BOOL ret; + HWND previous = 0; + + SERVER_START_REQ( set_capture_window ) + { + req->handle = 0; + req->flags = 0; + if ((ret = !wine_server_call_err( req ))) previous = reply->previous; + } + SERVER_END_REQ; + + if (previous) SendMessageW( previous, WM_CAPTURECHANGED, 0, 0 ); + return ret; } diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c index 658baeb311f..f2a795989f2 100644 --- a/dlls/user/tests/win.c +++ b/dlls/user/tests/win.c @@ -2173,6 +2173,8 @@ static void test_capture_2(void) static void test_capture_3(HWND hwnd1, HWND hwnd2) { + BOOL ret; + ShowWindow(hwnd1, SW_HIDE); ShowWindow(hwnd2, SW_HIDE); @@ -2188,7 +2190,10 @@ static void test_capture_3(HWND hwnd1, HWND hwnd2) ShowWindow(hwnd1, SW_SHOW); check_wnd_state(hwnd1, hwnd1, hwnd1, hwnd2); - ReleaseCapture(); + ret = ReleaseCapture(); + ok (ret, "releasecapture did not return TRUE.\n"); + ret = ReleaseCapture(); + ok (ret, "releasecapture did not return TRUE after second try.\n"); } static void test_keyboard_input(HWND hwnd)