Commit b4fea4f2 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

Killing the capture is already handled in DefWindowProc(). Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3d133bec
......@@ -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 )
......
......@@ -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;
......
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