Commit d13a44e4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 47b2238b
......@@ -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)
......
......@@ -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;
......
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