SetParent should not remove menu
Ulrich Czekalla
ulrich.czekalla at utoronto.ca
Mon Apr 25 13:37:38 CDT 2005
ChangeLog:
Ulrich Czekalla <ulrich at codeweavers.com>
SetParent should not remove menu from non-child windows
-------------- next part --------------
Index: dlls/user/tests/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/win.c,v
retrieving revision 1.56
diff -u -p -r1.56 win.c
--- dlls/user/tests/win.c 11 Apr 2005 12:47:02 -0000 1.56
+++ dlls/user/tests/win.c 25 Apr 2005 18:33:39 -0000
@@ -2409,8 +2409,9 @@ static void test_SetParent(void)
{
BOOL ret;
HWND desktop = GetDesktopWindow();
+ HMENU hMenu;
BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0;
- HWND parent, child1, child2, child3, child4;
+ HWND parent, child1, child2, child3, child4, sibling;
parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
@@ -2476,10 +2477,19 @@ todo_wine {
check_parents(child4, desktop, child2, child2, child2, child4, parent);
}
+ hMenu = CreateMenu();
+ sibling = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
+ 100, 100, 200, 200, 0, hMenu, 0, NULL);
+ assert(sibling != 0);
+
+ ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n");
+ ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n");
+
ret = DestroyWindow(parent);
ok( ret, "DestroyWindow() error %ld\n", GetLastError());
ok(!IsWindow(parent), "parent still exists\n");
+ ok(!IsWindow(sibling), "sibling still exists\n");
ok(!IsWindow(child1), "child1 still exists\n");
ok(!IsWindow(child2), "child2 still exists\n");
ok(!IsWindow(child3), "child3 still exists\n");
Index: dlls/x11drv/window.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/window.c,v
retrieving revision 1.107
diff -u -p -r1.107 window.c
--- dlls/x11drv/window.c 31 Mar 2005 15:44:20 -0000 1.107
+++ dlls/x11drv/window.c 25 Apr 2005 18:33:40 -0000
@@ -1134,11 +1134,6 @@ HWND X11DRV_SetParent( HWND hwnd, HWND p
if (parent != GetDesktopWindow()) /* a child window */
{
- if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD))
- {
- HMENU menu = (HMENU)SetWindowLongPtrW( hwnd, GWLP_ID, 0 );
- if (menu) DestroyMenu( menu );
- }
if (old_parent == GetDesktopWindow())
{
/* destroy the old X windows */
More information about the wine-patches
mailing list