Commit 27374064 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

user32: Make it possible to activate a window with parent and no WS_CHILD flag…

user32: Make it possible to activate a window with parent and no WS_CHILD flag in WS_NCLBUTTONDOWN function.
parent b82b1306
......@@ -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 );
......
......@@ -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);
......
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