Yet another fix to WinPosActivateOtherWindow, we should search only for top-level windows next to the window we're about to deactivate.

svn path=/trunk/; revision=16751
This commit is contained in:
Filip Navara 2005-07-26 19:02:31 +00:00
parent b165c36180
commit dfaa3196ee

View file

@ -114,6 +114,8 @@ WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
IntSetFocusMessageQueue(NULL); IntSetFocusMessageQueue(NULL);
return; return;
} }
/* If this is popup window, try to activate the owner first. */
if ((Window->Style & WS_POPUP) && (Wnd = IntGetOwner(Window))) if ((Window->Style & WS_POPUP) && (Wnd = IntGetOwner(Window)))
{ {
for(;;) for(;;)
@ -135,50 +137,21 @@ WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
IntReleaseWindowObject(Wnd); IntReleaseWindowObject(Wnd);
} }
/* Pick a next top-level window. */
/* FIXME: Search for non-tooltip windows first. */
Wnd = Window; Wnd = Window;
for(;;) while (Wnd != NULL)
{ {
HWND *List, *phWnd;
Old = Wnd; Old = Wnd;
Wnd = IntGetParentObject(Wnd); IntLockRelatives(Old);
if(Old != Window) Wnd = IntGetWindowObject(Old->NextSibling->Self);
{ IntUnLockRelatives(Old);
if (Old != Window)
IntReleaseWindowObject(Old); IntReleaseWindowObject(Old);
} if ((Wnd->Style & (WS_DISABLED | WS_VISIBLE)) == WS_VISIBLE &&
if(!Wnd) (Wnd->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
{ break;
IntSetFocusMessageQueue(NULL);
return;
}
if((List = IntWinListChildren(Wnd)))
{
/* FIXME: We should scan for non-tooltip windows first. */
for(phWnd = List; *phWnd; phWnd++)
{
PWINDOW_OBJECT Child;
if((*phWnd) == Window->Self)
{
continue;
}
if((Child = IntGetWindowObject(*phWnd)))
{
if ((Child->Style & (WS_DISABLED | WS_VISIBLE)) == WS_VISIBLE &&
(Child->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
{
ExFreePool(List);
IntReleaseWindowObject(Wnd);
Wnd = Child;
goto done;
}
IntReleaseWindowObject(Child);
}
}
ExFreePool(List);
}
} }
done: done:
@ -193,7 +166,8 @@ done:
} }
if (!IntSetActiveWindow(Wnd)) if (!IntSetActiveWindow(Wnd))
IntSetActiveWindow(0); IntSetActiveWindow(0);
IntReleaseWindowObject(Wnd); if (Wnd)
IntReleaseWindowObject(Wnd);
} }