Ilya Shpigor : user32: Fix switching focus to parent after child hiding.
Alexandre Julliard
julliard at winehq.org
Thu Nov 5 10:50:01 CST 2009
Module: wine
Branch: master
Commit: e6f040407647a3047ca4d1fa3afa137271c658cf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e6f040407647a3047ca4d1fa3afa137271c658cf
Author: Ilya Shpigor <shpigor at etersoft.ru>
Date: Wed Nov 4 15:49:11 2009 +0300
user32: Fix switching focus to parent after child hiding.
---
dlls/user32/tests/win.c | 11 ++++++++++-
dlls/user32/winpos.c | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 0bd6fbf..24e6ac2 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -2298,7 +2298,7 @@ static LRESULT WINAPI set_focus_on_activate_proc(HWND hwnd, UINT msg, WPARAM wp,
static void test_SetFocus(HWND hwnd)
{
- HWND child;
+ HWND child, child2;
WNDPROC old_wnd_proc;
/* check if we can set focus to non-visible windows */
@@ -2325,6 +2325,14 @@ static void test_SetFocus(HWND hwnd)
ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() );
ShowWindow(child, SW_SHOW);
+ child2 = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, child, 0, 0, NULL);
+ assert(child2);
+ ShowWindow(child2, SW_SHOW);
+ SetFocus(child2);
+ ShowWindow(child, SW_HIDE);
+ ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( GetFocus() == child2, "Focus should be on %p, not %p\n", child2, GetFocus() );
+ ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() == child, "Focus should be on child %p\n", child );
SetWindowPos(child,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW);
@@ -2368,6 +2376,7 @@ todo_wine
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
+ DestroyWindow( child2 );
DestroyWindow( child );
}
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index c62fdaa..915cb59 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1056,7 +1056,7 @@ static BOOL show_window( HWND hwnd, INT cmd )
/* Revert focus to parent */
hFocus = GetFocus();
- if (hwnd == hFocus || IsChild(hwnd, hFocus))
+ if (hwnd == hFocus)
{
HWND parent = GetAncestor(hwnd, GA_PARENT);
if (parent == GetDesktopWindow()) parent = 0;
More information about the wine-cvs
mailing list