Piotr Caban : user32: Make it possible to activate a window with parent and no WS_CHILD flag in WS_NCLBUTTONDOWN function.
Alexandre Julliard
julliard at winehq.org
Wed Apr 2 13:35:16 CDT 2014
Module: wine
Branch: master
Commit: 27374064b68136cbb628f85111c95d20e31699c9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=27374064b68136cbb628f85111c95d20e31699c9
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Apr 2 15:39:45 2014 +0200
user32: Make it possible to activate a window with parent and no WS_CHILD flag in WS_NCLBUTTONDOWN function.
---
dlls/user32/nonclient.c | 10 +++++++++-
dlls/user32/tests/win.c | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 5ea26dc..11b8d08 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -1396,7 +1396,15 @@ LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
case HTCAPTION:
{
- HWND top = GetAncestor( hwnd, GA_ROOT );
+ HWND top = hwnd, parent;
+ while(1)
+ {
+ if ((GetWindowLongW( top, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) != WS_CHILD)
+ break;
+ parent = GetAncestor( top, GA_PARENT );
+ if (!parent || parent == GetDesktopWindow()) break;
+ top = parent;
+ }
if (FOCUS_MouseActivate( top ) || (GetActiveWindow() == top))
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 0966bad..2d6e534 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7510,6 +7510,26 @@ todo_wine
DestroyWindow(parent);
}
+static void test_window_without_child_style(void)
+{
+ HWND hwnd;
+
+ hwnd = CreateWindowExA(0, "edit", NULL, WS_VISIBLE|WS_CHILD,
+ 0, 0, 50, 50, hwndMain, NULL, 0, NULL);
+ ok(hwnd != NULL, "CreateWindow failed\n");
+
+ ok(SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & (~WS_CHILD)),
+ "can't remove WS_CHILD style\n");
+
+ SetActiveWindow(hwndMain);
+ PostMessageW(hwnd, WM_LBUTTONUP, 0, 0);
+ SendMessageW(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
+ check_active_state(hwnd, hwnd, hwnd);
+ flush_events(TRUE);
+
+ DestroyWindow(hwnd);
+}
+
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
@@ -7640,6 +7660,7 @@ START_TEST(win)
test_winregion();
test_map_points();
test_update_region();
+ test_window_without_child_style();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);
More information about the wine-cvs
mailing list