From 8bbeadf56509317bba6f496030ecef2bb5d2bd29 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 24 Aug 2007 10:56:51 +0200 Subject: [PATCH] user32: IsChild must not consider the desktop window. --- dlls/user32/message.c | 2 +- dlls/user32/tests/msg.c | 2 -- dlls/user32/tests/win.c | 6 ------ dlls/user32/win.c | 2 +- dlls/winex11.drv/dce.c | 2 +- 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index c89a7ff802e..e87c4281653 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -303,7 +303,7 @@ static inline BOOL is_mouse_message( UINT message ) /* check whether message matches the specified hwnd filter */ static inline BOOL check_hwnd_filter( const MSG *msg, HWND hwnd_filter ) { - if (!hwnd_filter) return TRUE; + if (!hwnd_filter || hwnd_filter == GetDesktopWindow()) return TRUE; return (msg->hwnd == hwnd_filter || IsChild( hwnd_filter, msg->hwnd )); } diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index af05f7baa27..502cefc53d5 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -7476,9 +7476,7 @@ static void test_DestroyWindow(void) /* test owner/parent of the parent */ test = GetParent(parent); ok(!test, "wrong parent %p\n", test); -todo_wine { ok(!IsChild(GetDesktopWindow(), parent), "wrong parent/child %p/%p\n", GetDesktopWindow(), parent); -} if(pGetAncestor) { test = pGetAncestor(parent, GA_PARENT); ok(test == GetDesktopWindow(), "wrong parent %p\n", test); diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 3688bea6f24..34aadb1c962 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -2758,27 +2758,21 @@ static void test_SetParent(void) check_parents(child3, child2, child2, child2, 0, child2, parent); check_parents(child4, desktop, child2, child2, child2, child4, parent); -todo_wine { ok(!IsChild(desktop, parent), "wrong parent/child %p/%p\n", desktop, parent); ok(!IsChild(desktop, child1), "wrong parent/child %p/%p\n", desktop, child1); ok(!IsChild(desktop, child2), "wrong parent/child %p/%p\n", desktop, child2); ok(!IsChild(desktop, child3), "wrong parent/child %p/%p\n", desktop, child3); ok(!IsChild(desktop, child4), "wrong parent/child %p/%p\n", desktop, child4); -} ok(IsChild(parent, child1), "wrong parent/child %p/%p\n", parent, child1); -todo_wine { ok(!IsChild(desktop, child2), "wrong parent/child %p/%p\n", desktop, child2); -} ok(!IsChild(parent, child2), "wrong parent/child %p/%p\n", parent, child2); ok(!IsChild(child1, child2), "wrong parent/child %p/%p\n", child1, child2); ok(!IsChild(parent, child3), "wrong parent/child %p/%p\n", parent, child3); ok(IsChild(child2, child3), "wrong parent/child %p/%p\n", child2, child3); ok(!IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4); ok(!IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4); -todo_wine { ok(!IsChild(desktop, child4), "wrong parent/child %p/%p\n", desktop, child4); -} if (!is_win9x) /* Win9x doesn't survive this test */ { diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 0ef021afcf7..41eb108470f 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -2609,7 +2609,7 @@ BOOL WINAPI IsChild( HWND parent, HWND child ) if (!list) return FALSE; parent = WIN_GetFullHandle( parent ); for (i = 0; list[i]; i++) if (list[i] == parent) break; - ret = (list[i] != 0); + ret = list[i] && list[i+1]; HeapFree( GetProcessHeap(), 0, list ); return ret; } diff --git a/dlls/winex11.drv/dce.c b/dlls/winex11.drv/dce.c index 3b803083c8c..72c54299139 100644 --- a/dlls/winex11.drv/dce.c +++ b/dlls/winex11.drv/dce.c @@ -391,7 +391,7 @@ void invalidate_dce( HWND hwnd, const RECT *rect ) /* check if DCE window is within the z-order scope */ - if (hwndScope == dce->hwnd || IsChild( hwndScope, dce->hwnd )) + if (hwndScope == dce->hwnd || hwndScope == GetDesktopWindow() || IsChild( hwndScope, dce->hwnd )) { if (hwnd != dce->hwnd) {