Zebediah Figura : user32: Don't call ReleaseCapture() in EnableWindow().
Alexandre Julliard
julliard at winehq.org
Wed Mar 29 15:02:51 CDT 2017
Module: wine
Branch: master
Commit: b4fea4f2f0df40976f50d396e9e4046929697879
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b4fea4f2f0df40976f50d396e9e4046929697879
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Mon Mar 27 14:01:40 2017 -0500
user32: Don't call ReleaseCapture() in EnableWindow().
Killing the capture is already handled in DefWindowProc().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/win.c | 26 ++++++++++++++++++++++++++
dlls/user32/win.c | 6 ------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index f0ea182..fef9cb0 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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 )
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index f3b4ef5..38604b4 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -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;
More information about the wine-cvs
mailing list