user32: Don't use window's parent as an owner if WS_CHILD style is not set.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-02-22 12:54:59 +01:00 committed by Alexandre Julliard
parent 47b2238b3d
commit d13a44e4aa
2 changed files with 27 additions and 1 deletions

View File

@ -652,6 +652,31 @@ static void test_parent_owner(void)
DestroyWindow( child );
DestroyWindow( test );
DestroyWindow( owner );
/* Test that owner window takes into account WS_CHILD flag even if parent is set by SetParent. */
owner = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, desktop );
SetParent(owner, hwndMain);
check_parents( owner, hwndMain, hwndMain, NULL, NULL, hwndMain, owner );
test = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, owner );
check_parents( test, desktop, owner, NULL, owner, test, test );
DestroyWindow( owner );
DestroyWindow( test );
owner = create_tool_window( WS_VISIBLE | WS_CHILD, desktop );
SetParent(owner, hwndMain);
check_parents( owner, hwndMain, hwndMain, hwndMain, NULL, hwndMain, hwndMain );
test = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, owner );
check_parents( test, desktop, hwndMain, NULL, hwndMain, test, test );
DestroyWindow( owner );
DestroyWindow( test );
owner = create_tool_window( WS_VISIBLE | WS_POPUP | WS_CHILD, desktop );
SetParent(owner, hwndMain);
check_parents( owner, hwndMain, hwndMain, NULL, NULL, hwndMain, owner );
test = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, owner );
check_parents( test, desktop, owner, NULL, owner, test, test );
DestroyWindow( owner );
DestroyWindow( test );
}
static BOOL CALLBACK enum_proc( HWND hwnd, LPARAM lParam)

View File

@ -1901,7 +1901,8 @@ DECL_HANDLER(create_window)
return;
}
else /* owner must be a top-level window */
while (!is_desktop_window(owner->parent)) owner = owner->parent;
while ((owner->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !is_desktop_window(owner->parent))
owner = owner->parent;
}
atom = cls_name.len ? find_global_atom( NULL, &cls_name ) : req->atom;