user32: Don't call ReleaseCapture() in EnableWindow().

Killing the capture is already handled in DefWindowProc().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-03-27 14:01:40 -05:00 committed by Alexandre Julliard
parent 3d133becce
commit b4fea4f2f0
2 changed files with 26 additions and 6 deletions

View File

@ -6561,8 +6561,16 @@ static DWORD CALLBACK enablewindow_thread(LPVOID arg)
return 0;
}
static LRESULT CALLBACK enable_window_procA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_CANCELMODE)
return 0;
return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void test_EnableWindow(void)
{
WNDCLASSA cls;
HWND hwnd;
HANDLE hthread;
DWORD tid;
@ -6604,6 +6612,24 @@ static void test_EnableWindow(void)
CloseHandle(hthread);
DestroyWindow(hwnd);
/* test preventing release of capture */
memset(&cls, 0, sizeof(cls));
cls.lpfnWndProc = enable_window_procA;
cls.hInstance = GetModuleHandleA(0);
cls.lpszClassName = "EnableWindowClass";
ok(RegisterClassA(&cls), "RegisterClass failed\n");
hwnd = CreateWindowExA(0, "EnableWindowClass", NULL, WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, 0, 0, 0, NULL);
assert(hwnd);
SetFocus(hwnd);
SetCapture(hwnd);
EnableWindow(hwnd, FALSE);
check_wnd_state(hwnd, hwnd, 0, hwnd);
DestroyWindow(hwnd);
}
static DWORD CALLBACK gettext_msg_thread( LPVOID arg )

View File

@ -2161,8 +2161,6 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
}
else if (!enable && !retvalue)
{
HWND capture_wnd;
SendMessageW( hwnd, WM_CANCELMODE, 0, 0);
WIN_SetStyle( hwnd, WS_DISABLED, 0 );
@ -2170,10 +2168,6 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
if (hwnd == GetFocus())
SetFocus( 0 ); /* A disabled window can't have the focus */
capture_wnd = GetCapture();
if (capture_wnd && (hwnd == capture_wnd || IsChild(hwnd, capture_wnd)))
ReleaseCapture(); /* A disabled window can't capture the mouse */
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
}
return retvalue;