An owned popup window should be hidden when its owner window was minimized.
- Add IntWinListOwnedPopups function.
- Fix ShowWindow and ShowOwnedPopups functions.
CORE-14818
See also: CORE-3326, CORE-12252, CORE-13168, and CORE-14824.
if (!Wnd->spwndOwner) break;
if (LOWORD(lParam))
{
- if (wParam)
- {
- if (!(Wnd->state & WNDS_HIDDENPOPUP)) break;
- Wnd->state &= ~WNDS_HIDDENPOPUP;
- }
- else
- Wnd->state |= WNDS_HIDDENPOPUP;
-
co_WinPosShowWindow(Wnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
}
break;
return List;
}
+HWND* FASTCALL
+IntWinListOwnedPopups(PWND Window)
+{
+ PWND Child, Desktop;
+ HWND *List;
+ UINT Index, NumChildren = 0;
+
+ Desktop = co_GetDesktopWindow(Window);
+ if (!Desktop)
+ return NULL;
+
+ for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
+ ++NumChildren;
+
+ List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
+ if (!List)
+ {
+ ERR("Failed to allocate memory for children array\n");
+ EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return NULL;
+ }
+
+ Index = 0;
+ for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
+ {
+ if (Child->spwndOwner == Window)
+ List[Index++] = Child->head.h;
+ }
+ List[Index] = NULL;
+
+ return List;
+}
+
PWND FASTCALL
IntGetNonChildAncestor(PWND pWnd)
{
// ASSERT(OwnerWnd);
TRACE("Enter ShowOwnedPopups Show: %s\n", (fShow ? "TRUE" : "FALSE"));
- win_array = IntWinListChildren(OwnerWnd);
+
+ /* NOTE: Popups are not children */
+ win_array = IntWinListOwnedPopups(OwnerWnd);
if (!win_array)
return TRUE;
* regardless of the state of the owner
*/
co_IntSendMessage(win_array[count], WM_SHOWWINDOW, SW_SHOWNORMAL, SW_PARENTOPENING);
+ pWnd->state &= ~WNDS_HIDDENPOPUP;
continue;
}
}
* regardless of the state of the owner
*/
co_IntSendMessage(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
+ pWnd->state |= WNDS_HIDDENPOPUP;
continue;
}
}
-
}
ExFreePoolWithTag(win_array, USERTAG_WINDOWLIST);
TRACE("Leave ShowOwnedPopups\n");
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
BOOL FASTCALL IntIsWindow(HWND hWnd);
HWND* FASTCALL IntWinListChildren(PWND Window);
+HWND* FASTCALL IntWinListOwnedPopups(PWND Window);
VOID FASTCALL IntGetClientRect (PWND WindowObject, RECTL *Rect);
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints);
BOOL FASTCALL IntIsChildWindow (PWND Parent, PWND Child);
WinPosFindIconPos(Wnd, &wpl.ptMinPosition);
- /*if (!(old_style & WS_MINIMIZE))
+ if (!(old_style & WS_MINIMIZE))
{
SwpFlags |= SWP_STATECHANGED;
IntShowOwnedPopups(Wnd, FALSE);
- }*/
+ }
RECTL_vSetRect(NewPos, wpl.ptMinPosition.x, wpl.ptMinPosition.y,
wpl.ptMinPosition.x + UserGetSystemMetrics(SM_CXMINIMIZED),
old_style = IntSetStyle( Wnd, 0, WS_MINIMIZE | WS_MAXIMIZE );
if (old_style & WS_MINIMIZE)
{
- //IntShowOwnedPopups(Wnd, TRUE);
+ IntShowOwnedPopups(Wnd, TRUE);
if (Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED)
{