#define PLACE_MAX 0x0002
#define PLACE_RECT 0x0004
+VOID FASTCALL IntLinkWindow(PWND Wnd,PWND WndInsertAfter);
+
/* FUNCTIONS *****************************************************************/
BOOL FASTCALL
IntGetClientOrigin(PWND Window OPTIONAL, LPPOINT Point)
{
- Window = Window ? Window : UserGetWindowObject(IntGetDesktopWindow());
+ Window = Window ? Window : UserGetDesktopWindow();
if (Window == NULL)
{
Point->x = Point->y = 0;
/*
* Fix Z order taking into account owned popups -
* basically we need to maintain them above the window that owns them
+ *
+ * FIXME: hide/show owned popups when owner visibility changes.
+ *
+ * ReactOS: See bug 6751 and 7228.
*/
static
HWND FASTCALL
break;
if (HWND_TOP == hWndInsertAfter)
{
- ChildObject = UserGetWindowObject(List[i]);
+ ChildObject = ValidateHwndNoErr(List[i]);
if (NULL != ChildObject)
{
if (0 == (ChildObject->ExStyle & WS_EX_TOPMOST))
if (!List)
{
- DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
+ DesktopWindow = UserGetDesktopWindow();
List = IntWinListChildren(DesktopWindow);
}
if (List != NULL)
if (List[i] == Window->head.h)
break;
- if (!(Wnd = UserGetWindowObject(List[i])))
+ if (!(Wnd = ValidateHwndNoErr(List[i])))
continue;
if (Wnd->style & WS_POPUP && Wnd->spwndOwner == Window)
UserRefObjectCo(Wnd, &Ref);
co_WinPosSetWindowPos(Wnd, hWndInsertAfter, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING| SWP_DEFERERASE);
UserDerefObjectCo(Wnd);
if (WinPos->hwndInsertAfter == HWND_NOTOPMOST)
{
+ if (!(Wnd->ExStyle & WS_EX_TOPMOST))
+ WinPos->flags |= SWP_NOZORDER;
+
WinPos->hwndInsertAfter = HWND_TOP;
}
else if (HWND_TOP == WinPos->hwndInsertAfter
{
PWND InsAfterWnd;
- InsAfterWnd = UserGetWindowObject(WinPos->hwndInsertAfter);
+ InsAfterWnd = ValidateHwndNoErr(WinPos->hwndInsertAfter);
if(!InsAfterWnd)
{
return TRUE;
RECTL CopyRect;
PWND Ancestor;
BOOL bPointerInWindow;
+ BOOL bNoTopMost;
ASSERT_REFS_CO(Window);
co_WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect);
+ // HWND_NOTOPMOST is redirected in WinPosFixupFlags.
+ bNoTopMost = WndInsertAfter == HWND_NOTOPMOST;
+
/* Does the window still exist? */
if (!IntIsWindow(WinPos.hwnd))
{
+ TRACE("WinPosSetWindowPos: Invalid handle 0x%p!\n",WinPos.hwnd);
EngSetLastError(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
}
Ancestor = UserGetAncestor(Window, GA_PARENT);
- if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
- SWP_NOZORDER &&
+ if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) != SWP_NOZORDER &&
Ancestor && Ancestor->head.h == IntGetDesktopWindow() )
{
WinPos.hwndInsertAfter = WinPosDoOwnedPopups(Window, WinPos.hwndInsertAfter);
WvrFlags = co_WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect, &NewClientRect);
- TRACE("co_WinPosDoNCCALCSize returned %d\n", WvrFlags);
+ TRACE("co_WinPosDoNCCALCSize returned %d\n", WvrFlags);
- /* Relink windows. (also take into account shell window in hwndShellWindow) */
+ /* Validate link windows. (also take into account shell window in hwndShellWindow) */
if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
{
- IntLinkHwnd(Window, WndInsertAfter);
+ //// Fix bug 6751 & 7228 see WinPosDoOwnedPopups wine Fixme.
+ PWND ParentWindow;
+ PWND Sibling;
+ PWND InsertAfterWindow;
+
+ if ((ParentWindow = Window->spwndParent)) // Must have a Parent window!
+ {
+ if (WinPos.hwndInsertAfter == HWND_TOPMOST)
+ {
+ InsertAfterWindow = NULL;
+ }
+ else if ( WinPos.hwndInsertAfter == HWND_TOP )
+ {
+ InsertAfterWindow = NULL;
+
+ Sibling = ParentWindow->spwndChild;
+
+ while ( Sibling && Sibling->ExStyle & WS_EX_TOPMOST )
+ {
+ InsertAfterWindow = Sibling;
+ Sibling = Sibling->spwndNext;
+ }
+ }
+ else if (WinPos.hwndInsertAfter == HWND_BOTTOM)
+ {
+ if (ParentWindow->spwndChild)
+ {
+ InsertAfterWindow = ParentWindow->spwndChild;
+
+ if(InsertAfterWindow)
+ {
+ while (InsertAfterWindow->spwndNext)
+ InsertAfterWindow = InsertAfterWindow->spwndNext;
+ }
+ }
+ else
+ InsertAfterWindow = NULL;
+ }
+ else
+ InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter);
+ /* Do nothing if hwndInsertAfter is HWND_BOTTOM and Window is already
+ the last window */
+ if (InsertAfterWindow != Window)
+ {
+ IntUnlinkWindow(Window);
+ IntLinkWindow(Window, InsertAfterWindow);
+ }
+
+ if ( ( WinPos.hwndInsertAfter == HWND_TOPMOST ||
+ ( Window->ExStyle & WS_EX_TOPMOST && Window->spwndPrev && Window->spwndPrev->ExStyle & WS_EX_TOPMOST ) ||
+ ( Window->spwndNext && Window->spwndNext->ExStyle & WS_EX_TOPMOST ) ) &&
+ !bNoTopMost )
+ {
+ Window->ExStyle |= WS_EX_TOPMOST;
+ }
+ else
+ {
+ Window->ExStyle &= ~ WS_EX_TOPMOST;
+ }
+ }
+ ////
}
OldWindowRect = Window->rcWindow;
Window->rcWindow = NewWindowRect;
Window->rcClient = NewClientRect;
+ /* erase parent when hiding or resizing child */
if (WinPos.flags & SWP_HIDEWINDOW)
{
/* Clear the update region */
if (Window->spwndParent == UserGetDesktopWindow())
co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->head.h);
- Window->style &= ~WS_VISIBLE;
+ Window->style &= ~WS_VISIBLE; //IntSetStyle( Window, 0, WS_VISIBLE );
+ IntNotifyWinEvent(EVENT_OBJECT_HIDE, Window, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
}
else if (WinPos.flags & SWP_SHOWWINDOW)
{
if (Window->spwndParent == UserGetDesktopWindow())
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->head.h);
- Window->style |= WS_VISIBLE;
+ Window->style |= WS_VISIBLE; //IntSetStyle( Window, WS_VISIBLE, 0 );
+ IntNotifyWinEvent(EVENT_OBJECT_SHOW, Window, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
}
if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != HRGN_WINDOW)
NewWindowRect.top - OldWindowRect.top);
}
- DceResetActiveDCEs(Window);
+ DceResetActiveDCEs(Window); // For WS_VISIBLE changes.
if (!(WinPos.flags & SWP_NOREDRAW))
{
}
}
+ /* And last, send the WM_WINDOWPOSCHANGED message */
+
+ TRACE("\tstatus flags = %04x\n", WinPos.flags & SWP_AGG_STATUSFLAGS);
+
if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
{
/* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set
if ( WinPos.flags & SWP_FRAMECHANGED || WinPos.flags & SWP_STATECHANGED ||
!(WinPos.flags & SWP_NOCLIENTSIZE) || !(WinPos.flags & SWP_NOCLIENTMOVE) )
{
- PWND pWnd = UserGetWindowObject(WinPos.hwnd);
+ PWND pWnd = ValidateHwndNoErr(WinPos.hwnd);
if (pWnd)
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
}
winpos->pos.hwnd, winpos->pos.hwndInsertAfter, winpos->pos.x, winpos->pos.y,
winpos->pos.cx, winpos->pos.cy, winpos->pos.flags);
- pwnd = (PWND)UserGetObject(gHandleTable, winpos->pos.hwnd, otWindow);
+ pwnd = ValidateHwndNoErr(winpos->pos.hwnd);
if (!pwnd)
continue;
winpos->pos.cy,
winpos->pos.flags);
+ // Hack to pass tests.... Must have some work to do so clear the error.
+ if (res && (winpos->pos.flags & (SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER)) == SWP_NOZORDER )
+ EngSetLastError(ERROR_SUCCESS);
+
UserDerefObjectCo(pwnd);
}
ExFreePoolWithTag(pDWP->acvr, USERTAG_SWP);
return res;
}
-
/*
* @implemented
*/