user32: Fix switching focus to parent after child hiding.
This commit is contained in:
parent
3ec06f8082
commit
e6f0404076
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue