user32: Make it possible to activate a window with parent and no WS_CHILD flag in WS_NCLBUTTONDOWN function.

This commit is contained in:
Piotr Caban 2014-04-02 15:39:45 +02:00 committed by Alexandre Julliard
parent b82b1306a4
commit 27374064b6
2 changed files with 30 additions and 1 deletions

View File

@ -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 );

View File

@ -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);