Don't drop owned windows in WIN_EnumChildWindows.

Vitaliy Margolen wine-patch at kievinfo.com
Wed Nov 30 10:22:11 CST 2005


ChangeLog:
Don't drop owned windows in WIN_EnumChildWindows. They won't be returned in
WIN_ListChildren anyway.
Add few tests to test this.

 dlls/user/tests/win.c |   16 ++++++++++++++++
 dlls/user/win.c       |    2 --
 2 files changed, 16 insertions(+), 2 deletions(-)
-------------- next part --------------
d6a248f1fff94f9fe25ec84f7a760132ebc6b9fd
diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c
index e1f787b..86833e3 100644
--- a/dlls/user/tests/win.c
+++ b/dlls/user/tests/win.c
@@ -471,8 +471,24 @@ static void test_parent_owner(void)
     ok( !EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
         "EnumChildWindows should have returned FALSE\n" );
     ok( numChildren == 2, "numChildren should be 2 got %d\n", numChildren );
+    DestroyWindow( child );
 
+    child = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, owner );
+    ok( GetWindow( child, GW_OWNER ) == owner, "Wrong owner window\n" );
+    numChildren = 0;
+    ok( EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
+        "EnumChildWindows should have returned TRUE\n" );
+    ok( numChildren == 1, "numChildren should be 1 got %d\n", numChildren );
+
+    ret = SetParent( child, owner );
+    ok( GetWindow( child, GW_OWNER ) == owner, "Wrong owner window\n" );
+    ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
+    numChildren = 0;
+    ok( !EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
+        "EnumChildWindows should have returned FALSE\n" );
+    ok( numChildren == 2, "numChildren should be 2 got %d\n", numChildren );
     DestroyWindow( child );
+
     DestroyWindow( test );
     DestroyWindow( owner );
 }
diff --git a/dlls/user/win.c b/dlls/user/win.c
index dbdb7e5..1e3b418 100644
--- a/dlls/user/win.c
+++ b/dlls/user/win.c
@@ -2812,8 +2812,6 @@ static BOOL WIN_EnumChildWindows( HWND *
     {
         /* Make sure that the window still exists */
         if (!IsWindow( *list )) continue;
-        /* skip owned windows */
-        if (GetWindow( *list, GW_OWNER )) continue;
         /* Build children list first */
         childList = WIN_ListChildren( *list );
 


More information about the wine-patches mailing list