#define SWP_EX_PAINTSELF 0x0002
#define SWP_AGG_NOGEOMETRYCHANGE \
- (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
+ (SWP_NOSIZE | SWP_NOCLIENTSIZE | SWP_NOZORDER)
#define SWP_AGG_NOPOSCHANGE \
- (SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
+ (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
#define SWP_AGG_STATUSFLAGS \
(SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
Delta.y -= ToWnd->rcClient.top;
}
- if (mirror_from) Delta.x = -Delta.x;
-
for (i = 0; i != cPoints; i++)
{
lpPoints[i].x += Delta.x;
}
//
-// This helps with bug 6751 forcing modal dialog active when another app is minimized or closed.
+// This helps with CORE-6129 forcing modal dialog active when another app is minimized or closed.
//
BOOL FASTCALL ActivateOtherWindowMin(PWND Wnd)
{
USER_REFERENCE_ENTRY Ref;
PTHREADINFO pti = gptiCurrent;
- //ERR("AOWM 1\n");
+ //ERR("AOWM 1 %p\n",Wnd->head.h);
ActivePrev = (pti->MessageQueue->spwndActivePrev != NULL);
FindTopWnd = TRUE;
//ERR("ActivateOtherWindowMin Set FG 1\n");
co_IntSetForegroundWindow(pWndSetActive);
UserDerefObjectCo(pWndSetActive);
- //ERR("AOWM 2 Exit Good\n");
+ //ERR("AOWM 2 Exit Good %p\n",pWndSetActive->head.h);
return TRUE;
}
if (!pWndTemp ) pWndTemp = pWndSetActive;
//ERR("ActivateOtherWindowMin Set FG 2\n");
co_IntSetForegroundWindow(pWndSetActive);
UserDerefObjectCo(pWndSetActive);
- //ERR("AOWM 3 Exit Good\n");
+ //ERR("AOWM 3 Exit Good %p\n",pWndSetActive->head.h);
return TRUE;
}
//ERR("AOWM 4 Bad\n");
/* If this is popup window, try to activate the owner first. */
if ((Wnd->style & WS_POPUP) && (WndTo = Wnd->spwndOwner))
{
+ TRACE("WPAOW Popup with Owner\n");
WndTo = UserGetAncestor( WndTo, GA_ROOT );
if (can_activate_window(WndTo)) goto done;
}
WndTo = Wnd;
for (;;)
{
- if (!(WndTo = WndTo->spwndNext)) break;
- if (can_activate_window( WndTo )) break;
+ if (!(WndTo = WndTo->spwndNext)) break;
+ if (can_activate_window( WndTo )) goto done;
}
-done:
+ /*
+ Fixes wine win.c:test_SetParent last ShowWindow test after popup dies.
+ Check for previous active window to bring to top.
+ */
+ if (Wnd)
+ {
+ WndTo = Wnd->head.pti->MessageQueue->spwndActivePrev;
+ if (can_activate_window( WndTo )) goto done;
+ }
+
+ // Find any window to bring to top. Works Okay for wine since it does not see X11 windows.
+ WndTo = UserGetDesktopWindow();
+ WndTo = WndTo->spwndChild;
+ if ( WndTo == NULL )
+ {
+ return;
+ }
+ for (;;)
+ {
+ if (WndTo == Wnd)
+ {
+ WndTo = NULL;
+ break;
+ }
+ if (can_activate_window( WndTo )) goto done;
+ if (!(WndTo = WndTo->spwndNext)) break;
+ }
+done:
if (WndTo) UserRefObjectCo(WndTo, &Ref);
- if (!gpqForeground || Wnd == gpqForeground->spwndActive)
+ if (gpqForeground && (!gpqForeground->spwndActive || Wnd == gpqForeground->spwndActive))
{
/* ReactOS can pass WndTo = NULL to co_IntSetForegroundWindow and returns FALSE. */
- //ERR("WinPosActivateOtherWindow Set FG 0x%p\n",WndTo);
+ //ERR("WinPosActivateOtherWindow Set FG 0x%p hWnd %p\n",WndTo, WndTo ? WndTo->head.h : 0);
if (co_IntSetForegroundWindow(WndTo))
{
if (WndTo) UserDerefObjectCo(WndTo);
//ERR("WinPosActivateOtherWindow Set Active 0x%p\n",WndTo);
if (!co_IntSetActiveWindow(WndTo,FALSE,TRUE,FALSE)) /* Ok for WndTo to be NULL here */
{
+ //ERR("WPAOW SA 1\n");
co_IntSetActiveWindow(NULL,FALSE,TRUE,FALSE);
}
if (WndTo) UserDerefObjectCo(WndTo);
}
-UINT
-FASTCALL
-co_WinPosArrangeIconicWindows(PWND parent)
-{
- RECTL rectParent;
- INT i, x, y, xspacing, yspacing, sx, sy;
- HWND *List = IntWinListChildren(parent);
-
- ASSERT_REFS_CO(parent);
-
- /* Check if we found any children */
- if(List == NULL)
- {
- return 0;
- }
-
- IntGetClientRect( parent, &rectParent );
- // FIXME: Support gspv.mm.iArrange.
- x = rectParent.left;
- y = rectParent.bottom;
-
- xspacing = (UserGetSystemMetrics(SM_CXMINSPACING)/2)+UserGetSystemMetrics(SM_CXBORDER);
- yspacing = (UserGetSystemMetrics(SM_CYMINSPACING)/2)+UserGetSystemMetrics(SM_CYBORDER);
-
- //ERR("X:%d Y:%d XS:%d YS:%d\n",x,y,xspacing,yspacing);
-
- for(i = 0; List[i]; i++)
- {
- PWND Child;
-
- if (!(Child = ValidateHwndNoErr(List[i])))
- continue;
-
- if((Child->style & WS_MINIMIZE) != 0 )
- {
- USER_REFERENCE_ENTRY Ref;
- UserRefObjectCo(Child, &Ref);
-
- sx = x + UserGetSystemMetrics(SM_CXBORDER);
- sy = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
-
- co_WinPosSetWindowPos( Child, 0, sx, sy, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
-
- Child->InternalPos.IconPos.x = sx;
- Child->InternalPos.IconPos.y = sy;
- Child->InternalPos.flags |= WPF_MININIT;
- Child->InternalPos.flags &= ~WPF_SETMINPOSITION;
-
- UserDerefObjectCo(Child);
-
- if (x <= (rectParent.right - UserGetSystemMetrics(SM_CXMINSPACING)))
- x += xspacing;
- else
- {
- x = rectParent.left;
- y -= yspacing;
- }
- //ERR("X:%d Y:%d\n",x,y);
- }
- }
- ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
- return yspacing;
-}
-
-static VOID FASTCALL
-WinPosFindIconPos(PWND Window, POINT *Pos)
-{
- RECT rectParent;
- PWND pwndChild, pwndParent;
- int x, y, xspacing, yspacing;
-
- pwndParent = Window->spwndParent;
- if (pwndParent == UserGetDesktopWindow())
- {
- //ERR("Parent is Desktop, Min off screen!\n");
- /* ReactOS doesn't support iconic minimize to desktop */
- Pos->x = Pos->y = -32000;
- Window->InternalPos.flags |= WPF_MININIT;
- Window->InternalPos.IconPos.x = Pos->x;
- Window->InternalPos.IconPos.y = Pos->y;
- return;
- }
-
- IntGetClientRect( pwndParent, &rectParent );
- // FIXME: Support gspv.mm.iArrange.
- x = rectParent.left;
- y = rectParent.bottom;
-
- xspacing = (UserGetSystemMetrics(SM_CXMINSPACING)/2)+UserGetSystemMetrics(SM_CXBORDER);
- yspacing = (UserGetSystemMetrics(SM_CYMINSPACING)/2)+UserGetSystemMetrics(SM_CYBORDER);
-
- //ERR("X:%d Y:%d XS:%d YS:%d\n",Pos->x,Pos->y,xspacing,yspacing);
-
- // Set to default position when minimized.
- Pos->x = x + UserGetSystemMetrics(SM_CXBORDER);
- Pos->y = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
-
- for (pwndChild = pwndParent->spwndChild; pwndChild; pwndChild = pwndChild->spwndNext)
- {
- if (pwndChild == Window) continue;
-
- if (pwndChild->style & WS_VISIBLE)
- {
- //ERR("Loop!\n");
- continue;
- }
- //ERR("Pos Child X %d Y %d!\n", pwndChild->InternalPos.IconPos.x, pwndChild->InternalPos.IconPos.y);
- if ( pwndChild->InternalPos.IconPos.x == Pos->x &&
- pwndChild->InternalPos.IconPos.y == Pos->y )
- {
- if (x <= rectParent.right - UserGetSystemMetrics(SM_CXMINSPACING))
- x += xspacing;
- else
- {
- x = rectParent.left;
- y -= yspacing;
- }
- Pos->x = x + UserGetSystemMetrics(SM_CXBORDER);
- Pos->y = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
- }
- }
- Window->InternalPos.IconPos.x = Pos->x;
- Window->InternalPos.IconPos.y = Pos->y;
- Window->InternalPos.flags |= WPF_MININIT;
- //ERR("Position is set! X:%d Y:%d\n",Pos->x,Pos->y);
- return;
-}
-
VOID FASTCALL
WinPosInitInternalPos(PWND Wnd, RECTL *RestoreRect)
{
POINT Size;
RECTL Rect = *RestoreRect;
- if (Wnd->spwndParent != UserGetDesktopWindow())
+ if (Wnd->spwndParent && Wnd->spwndParent != UserGetDesktopWindow())
{
RECTL_vOffsetRect(&Rect,
-Wnd->spwndParent->rcClient.left,
return TRUE;
}
+UINT
+FASTCALL
+co_WinPosArrangeIconicWindows(PWND parent)
+{
+ RECTL rectParent;
+ PWND Child;
+ INT x, y, xspacing, yspacing, sx, sy;
+
+ ASSERT_REFS_CO(parent);
+
+ IntGetClientRect( parent, &rectParent );
+ // FIXME: Support Minimize Metrics gspv.mm.iArrange.
+ // Default: ARW_BOTTOMLEFT
+ x = rectParent.left;
+ y = rectParent.bottom;
+
+ xspacing = UserGetSystemMetrics(SM_CXMINIMIZED);
+ yspacing = UserGetSystemMetrics(SM_CYMINIMIZED);
+
+ Child = parent->spwndChild;
+ while(Child)
+ {
+ if((Child->style & WS_MINIMIZE) != 0 )
+ {
+ USER_REFERENCE_ENTRY Ref;
+ UserRefObjectCo(Child, &Ref);
+
+ sx = x + UserGetSystemMetrics(SM_CXBORDER);
+ sy = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
+
+ Child->InternalPos.IconPos.x = sx;
+ Child->InternalPos.IconPos.y = sy;
+ Child->InternalPos.flags |= WPF_MININIT;
+
+ co_WinPosSetWindowPos( Child, 0, sx, sy, xspacing, yspacing, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_ASYNCWINDOWPOS);
+
+ UserDerefObjectCo(Child);
+
+ if (x <= rectParent.right - xspacing)
+ x += xspacing;
+ else
+ {
+ x = rectParent.left;
+ y -= yspacing;
+ }
+ }
+ Child = Child->spwndNext;
+ }
+ return yspacing;
+}
+
+static VOID FASTCALL
+WinPosFindIconPos(PWND Window, POINT *Pos)
+{
+ RECT rectParent;
+ PWND pwndChild, pwndParent;
+ int x, y, xspacing, yspacing;
+
+ pwndParent = Window->spwndParent;
+ if (pwndParent == UserGetDesktopWindow())
+ {
+ ERR("Parent is Desktop, Min off screen!\n");
+ /* ReactOS doesn't support iconic minimize to desktop */
+ Pos->x = Pos->y = -32000;
+ Window->InternalPos.flags |= WPF_MININIT;
+ Window->InternalPos.IconPos.x = Pos->x;
+ Window->InternalPos.IconPos.y = Pos->y;
+ return;
+ }
+
+ IntGetClientRect( pwndParent, &rectParent );
+ // FIXME: Support Minimize Metrics gspv.mm.iArrange.
+ // Default: ARW_BOTTOMLEFT
+ x = rectParent.left;
+ y = rectParent.bottom;
+
+ xspacing = UserGetSystemMetrics(SM_CXMINIMIZED);
+ yspacing = UserGetSystemMetrics(SM_CYMINIMIZED);
+
+ // Set to default position when minimized.
+ Pos->x = x + UserGetSystemMetrics(SM_CXBORDER);
+ Pos->y = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
+
+ for (pwndChild = pwndParent->spwndChild; pwndChild; pwndChild = pwndChild->spwndNext)
+ {
+ if (pwndChild == Window) continue;
+
+ if ((pwndChild->style & (WS_VISIBLE|WS_MINIMIZE)) != (WS_VISIBLE|WS_MINIMIZE) )
+ {
+ continue;
+ }
+
+ if ( pwndChild->InternalPos.IconPos.x != Pos->x && pwndChild->InternalPos.IconPos.y != Pos->y )
+ {
+ break;
+ }
+ if (x <= rectParent.right - xspacing)
+ x += xspacing;
+ else
+ {
+ x = rectParent.left;
+ y -= yspacing;
+ }
+ Pos->x = x + UserGetSystemMetrics(SM_CXBORDER);
+ Pos->y = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
+ }
+
+ Window->InternalPos.IconPos.x = Pos->x;
+ Window->InternalPos.IconPos.y = Pos->y;
+ Window->InternalPos.flags |= WPF_MININIT;
+ TRACE("Position is set! X:%d Y:%d\n",Pos->x,Pos->y);
+ return;
+}
+
UINT FASTCALL
co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT* NewPos)
{
{
switch (ShowFlag)
{
+ case SW_MINIMIZE:
case SW_SHOWMINNOACTIVE:
case SW_SHOWMINIMIZED:
case SW_FORCEMINIMIZE:
- case SW_MINIMIZE:
return SWP_NOSIZE | SWP_NOMOVE;
}
if (!co_IntSendMessageNoWait(Wnd->head.h, WM_QUERYOPEN, 0, 0))
}
switch (ShowFlag)
{
+ case SW_MINIMIZE:
case SW_SHOWMINNOACTIVE:
case SW_SHOWMINIMIZED:
case SW_FORCEMINIMIZE:
- case SW_MINIMIZE:
{
//ERR("MinMaximize Minimize\n");
if (Wnd->style & WS_MAXIMIZE)
old_style = IntSetStyle( Wnd, WS_MINIMIZE, WS_MAXIMIZE );
- co_UserRedrawWindow(Wnd, NULL, 0, RDW_VALIDATE | RDW_NOERASE |
- RDW_NOINTERNALPAINT);
+ co_UserRedrawWindow(Wnd, NULL, 0, RDW_VALIDATE | RDW_NOERASE | RDW_NOINTERNALPAINT);
if (!(Wnd->InternalPos.flags & WPF_SETMINPOSITION))
Wnd->InternalPos.flags &= ~WPF_MININIT;
WinPosFindIconPos(Wnd, &wpl.ptMinPosition);
- if (!(old_style & WS_MINIMIZE)) SwpFlags |= SWP_STATECHANGED;
+ /*if (!(old_style & WS_MINIMIZE))
+ {
+ SwpFlags |= SWP_STATECHANGED;
+ IntShowOwnedPopups(Wnd, FALSE);
+ }*/
- /*ERR("Minimize: %d,%d %dx%d\n",
- wpl.ptMinPosition.x, wpl.ptMinPosition.y, UserGetSystemMetrics(SM_CXMINIMIZED),
- UserGetSystemMetrics(SM_CYMINIMIZED));
- */
RECTL_vSetRect(NewPos, wpl.ptMinPosition.x, wpl.ptMinPosition.y,
-// wpl.ptMinPosition.x + UserGetSystemMetrics(SM_CXMINIMIZED),
-// wpl.ptMinPosition.y + UserGetSystemMetrics(SM_CYMINIMIZED));
- UserGetSystemMetrics(SM_CXMINIMIZED),
- UserGetSystemMetrics(SM_CYMINIMIZED));
+ wpl.ptMinPosition.x + UserGetSystemMetrics(SM_CXMINIMIZED),
+ wpl.ptMinPosition.y + UserGetSystemMetrics(SM_CYMINIMIZED));
SwpFlags |= SWP_NOCOPYBITS;
break;
}
wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
*/
old_style = IntSetStyle( Wnd, WS_MAXIMIZE, WS_MINIMIZE );
+ /*if (old_style & WS_MINIMIZE)
+ {
+ IntShowOwnedPopups(Wnd, TRUE);
+ }*/
if (!(old_style & WS_MAXIMIZE)) SwpFlags |= SWP_STATECHANGED;
RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y,
-// wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
+ //wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
Size.x, Size.y);
break;
}
old_style = IntSetStyle( Wnd, 0, WS_MINIMIZE | WS_MAXIMIZE );
if (old_style & WS_MINIMIZE)
{
+ //IntShowOwnedPopups(Wnd, TRUE);
+
if (Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED)
{
co_WinPosGetMinMaxInfo(Wnd, &Size, &wpl.ptMaxPosition, NULL, NULL);
IntSetStyle( Wnd, WS_MAXIMIZE, 0 );
SwpFlags |= SWP_STATECHANGED;
- /*ERR("Restore to Max: %d,%d %dx%d\n",
- wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
- */
RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y,
-// wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
- Size.x, Size.y);
+ wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
break;
}
else
{
*NewPos = wpl.rcNormalPosition;
- /*ERR("Restore Max: %d,%d %dx%d\n",
- NewPos->left, NewPos->top, NewPos->right - NewPos->left, NewPos->bottom - NewPos->top);
- */
NewPos->right -= NewPos->left;
NewPos->bottom -= NewPos->top;
break;
SwpFlags |= SWP_STATECHANGED;
Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
*NewPos = wpl.rcNormalPosition;
- /*ERR("Restore Min: %d,%d %dx%d\n",
- NewPos->left, NewPos->top, NewPos->right - NewPos->left, NewPos->bottom - NewPos->top);
- */
NewPos->right -= NewPos->left;
NewPos->bottom -= NewPos->top;
break;
Parent = Window->spwndParent;
if (0 != (Window->style & WS_CHILD) && Parent)
{
- RECTL_vOffsetRect(&(params.rgrc[0]), - Parent->rcClient.left,
- - Parent->rcClient.top);
- RECTL_vOffsetRect(&(params.rgrc[1]), - Parent->rcClient.left,
- - Parent->rcClient.top);
- RECTL_vOffsetRect(&(params.rgrc[2]), - Parent->rcClient.left,
- - Parent->rcClient.top);
+ RECTL_vOffsetRect(&(params.rgrc[0]), - Parent->rcClient.left, - Parent->rcClient.top);
+ RECTL_vOffsetRect(&(params.rgrc[1]), - Parent->rcClient.left, - Parent->rcClient.top);
+ RECTL_vOffsetRect(&(params.rgrc[2]), - Parent->rcClient.left, - Parent->rcClient.top);
}
params.lppos = &winposCopy;
*ClientRect = params.rgrc[0]; // First rectangle contains the coordinates of the new client rectangle resulting from the move or resize
if ((Window->style & WS_CHILD) && Parent)
{
- RECTL_vOffsetRect(ClientRect, Parent->rcClient.left,
- Parent->rcClient.top);
+ RECTL_vOffsetRect(ClientRect, Parent->rcClient.left, Parent->rcClient.top);
}
FixClientRect(ClientRect, WindowRect);
}
WinPos->flags &= ~SWP_NOCLIENTMOVE;
}
- if (ClientRect->right - ClientRect->left !=
- Window->rcClient.right - Window->rcClient.left)
+ if (ClientRect->right - ClientRect->left != Window->rcClient.right - Window->rcClient.left)
{
WinPos->flags &= ~SWP_NOCLIENTSIZE;
}
else
wvrFlags &= ~WVR_HREDRAW;
- if (ClientRect->bottom - ClientRect->top !=
- Window->rcClient.bottom - Window->rcClient.top)
+ if (ClientRect->bottom - ClientRect->top != Window->rcClient.bottom - Window->rcClient.top)
{
WinPos->flags &= ~SWP_NOCLIENTSIZE;
}
if (!(WinPos->flags & SWP_NOSENDCHANGING))
{
- co_IntSendMessageNoWait(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
+ TRACE("Sending WM_WINDOWPOSCHANGING to hwnd %p flags %04x.\n", Window->head.h,WinPos->flags);
+ co_IntSendMessage(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
}
/* Calculate new position and size */
{
if (Window->style & WS_MINIMIZE)
{
- WindowRect->right = WindowRect->left + UserGetSystemMetrics(SM_CXICON);
- WindowRect->bottom = WindowRect->top + UserGetSystemMetrics(SM_CYICON);
+ WindowRect->right = WindowRect->left + UserGetSystemMetrics(SM_CXMINIMIZED);
+ WindowRect->bottom = WindowRect->top + UserGetSystemMetrics(SM_CYMINIMIZED);
}
else
{
WindowRect->bottom = WindowRect->top + WinPos->cy;
}
}
-#if 0
- if (!(WinPos->flags & SWP_NOMOVE))
- {
- WindowRect->left = WinPos->x;
- WindowRect->top = WinPos->y;
- WindowRect->right += WinPos->x - Window->rcWindow.left;
- WindowRect->bottom += WinPos->y - Window->rcWindow.top;
- RECTL_vOffsetRect(ClientRect,
- WinPos->x - Window->rcWindow.left,
- WinPos->y - Window->rcWindow.top);
-
- }
- *WindowRect = Window->rcWindow;
- *ClientRect = Window->rcClient;
+ WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
- if (!(WinPos->flags & SWP_NOSIZE))
- {
- WindowRect->right = WindowRect->left + WinPos->cx;
- WindowRect->bottom = WindowRect->top + WinPos->cy;
- }
-#endif
if (!(WinPos->flags & SWP_NOMOVE))
{
INT X, Y;
PWND Parent;
X = WinPos->x;
Y = WinPos->y;
- //ERR("Not SWP_NOMOVE\n");
+
Parent = Window->spwndParent;
- if (((Window->style & WS_CHILD) != 0) &&
+
+ // Fix wine msg test_SetParent:WmSetParentSeq_2:19 wParam bits.
+ WinPos->flags &= ~SWP_NOCLIENTMOVE;
+
+ // Parent child position issue is in here. SetParent_W7 test CORE-6651.
+ if (//((Window->style & WS_CHILD) != 0) && <- Fixes wine msg test_SetParent: "rects do not match", the last test.
Parent &&
Parent != Window->head.rpdesk->pDeskInfo->spwnd)
{
- //ERR("Not SWP_NOMOVE 1 Parent client offset X %d Y %d\n",X,Y);
+ TRACE("Not SWP_NOMOVE 1 Parent client offset X %d Y %d\n",X,Y);
X += Parent->rcClient.left;
Y += Parent->rcClient.top;
- //ERR("Not SWP_NOMOVE 2 Parent client offset X %d Y %d\n",X,Y);
+ TRACE("Not SWP_NOMOVE 2 Parent client offset X %d Y %d\n",X,Y);
}
WindowRect->left = X;
Y - Window->rcWindow.top);
}
- WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
-
TRACE( "hwnd %p, after %p, swp %d,%d %dx%d flags %08x\n",
WinPos->hwnd, WinPos->hwndInsertAfter, WinPos->x, WinPos->y,
WinPos->cx, WinPos->cy, WinPos->flags );
+ TRACE("WindowRect: %d %d %d %d\n", WindowRect->left,WindowRect->top,WindowRect->right,WindowRect->bottom);
+ TRACE("ClientRect: %d %d %d %d\n", ClientRect->left,ClientRect->top,ClientRect->right,ClientRect->bottom);
return TRUE;
}
*
* FIXME: hide/show owned popups when owner visibility changes.
*
- * ReactOS: See bug 6751 and 7228.
+ * ReactOS: See bug CORE-6129 and CORE-6554.
*
*/
////
if (hWndInsertAfter == HWND_BOTTOM)
{
- TRACE("Window is HWND_BOTTOM\n");
+ ERR("Window is HWND_BOTTOM\n");
if (List) ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
goto done;
}
TRACE("skip all the topmost windows\n");
/* skip all the topmost windows */
while (List[i] &&
- (ChildObject = ValidateHwndNoErr(List[i])) &&
+ (ChildObject = ValidateHwndNoErr(List[i])) &&
(ChildObject->ExStyle & WS_EX_TOPMOST)) i++;
}
}
PWND Child;
ASSERT(Window != Window->spwndChild);
+ TRACE("InternalMoveWin X %d Y %d\n", MoveX, MoveY);
Window->rcWindow.left += MoveX;
Window->rcWindow.right += MoveX;
POINT pt;
/* Finally make sure that all coordinates are valid */
- if (WinPos->x < -32768) WinPos->x = -32768;
+ if (WinPos->x < -32768) WinPos->x = -32768;
else if (WinPos->x > 32767) WinPos->x = 32767;
- if (WinPos->y < -32768) WinPos->y = -32768;
+ if (WinPos->y < -32768) WinPos->y = -32768;
else if (WinPos->y > 32767) WinPos->y = 32767;
WinPos->cx = max(WinPos->cx, 0);
WinPos->cy = max(WinPos->cy, 0);
Parent = UserGetAncestor( Wnd, GA_PARENT );
- if (!IntIsWindowVisible( Parent )) WinPos->flags |= SWP_NOREDRAW;
+ if (!IntIsWindowVisible( Parent ) &&
+ /* Fix B : wine msg test_SetParent:WmSetParentSeq_2:25 wParam bits! */
+ (WinPos->flags & SWP_AGG_STATUSFLAGS) == SWP_AGG_NOPOSCHANGE) WinPos->flags |= SWP_NOREDRAW;
if (Wnd->style & WS_VISIBLE) WinPos->flags &= ~SWP_SHOWWINDOW;
else
pt.x = WinPos->x;
pt.y = WinPos->y;
IntClientToScreen( Parent, &pt );
- //ERR("WPFU C2S wpx %d wpy %d ptx %d pty %d\n",WinPos->x,WinPos->y,pt.x,pt.y);
+ TRACE("WPFU C2S wpx %d wpy %d ptx %d pty %d\n",WinPos->x,WinPos->y,pt.x,pt.y);
/* Check for right position */
if (Wnd->rcWindow.left == pt.x && Wnd->rcWindow.top == pt.y)
{
WinPos->flags |= SWP_NOMOVE;
}
- if (WinPos->hwnd == UserGetForegroundWindow())
+ if ( WinPos->hwnd != UserGetForegroundWindow() && (Wnd->style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
{
- WinPos->flags |= SWP_NOACTIVATE; /* Already active */
- }
- else
- if ((Wnd->style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
+ /* Bring to the top when activating */
+ if (!(WinPos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW)) &&
+ (WinPos->flags & SWP_NOZORDER ||
+ (WinPos->hwndInsertAfter != HWND_TOPMOST && WinPos->hwndInsertAfter != HWND_NOTOPMOST)))
{
- /* Bring to the top when activating */
- if (!(WinPos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW)) &&
- (WinPos->flags & SWP_NOZORDER ||
- (WinPos->hwndInsertAfter != HWND_TOPMOST && WinPos->hwndInsertAfter != HWND_NOTOPMOST)))
- {
- WinPos->flags &= ~SWP_NOZORDER;
- WinPos->hwndInsertAfter = (0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP);
- }
+ WinPos->flags &= ~SWP_NOZORDER;
+ WinPos->hwndInsertAfter = (0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP);
}
+ }
/* Check hwndInsertAfter */
if (!(WinPos->flags & SWP_NOZORDER))
WinPos->hwndInsertAfter = HWND_TOPMOST;
if (IntGetWindow(WinPos->hwnd, GW_HWNDFIRST) == WinPos->hwnd)
+ {
WinPos->flags |= SWP_NOZORDER;
+ }
}
else if (WinPos->hwndInsertAfter == HWND_BOTTOM)
{
RECTL NewWindowRect;
RECTL NewClientRect;
RECTL valid_rects[2];
- PROSRGNDATA VisRgn;
- HRGN VisBefore = NULL;
- HRGN VisAfter = NULL;
- HRGN DirtyRgn = NULL;
- HRGN ExposedRgn = NULL;
- HRGN CopyRgn = NULL;
+ PREGION VisBefore = NULL;
+ PREGION VisBeforeJustClient = NULL;
+ PREGION VisAfter = NULL;
+ PREGION CopyRgn = NULL;
ULONG WvrFlags = 0;
RECTL OldWindowRect, OldClientRect;
int RgnType;
RECTL CopyRect;
PWND Ancestor;
BOOL bPointerInWindow;
- //BOOL bNoTopMost;
+ PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
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))
{
{
VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE,
(Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
- VisRgn = NULL;
if ( VisBefore != NULL &&
- (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) &&
- REGION_Complexity(VisRgn) == NULLREGION )
+ REGION_Complexity(VisBefore) == NULLREGION )
{
- RGNOBJAPI_Unlock(VisRgn);
- GreDeleteObject(VisBefore);
+ REGION_Delete(VisBefore);
VisBefore = NULL;
}
- else if(VisRgn)
+ else if(VisBefore)
+ {
+ REGION_bOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top);
+ }
+
+ /* Calculate the non client area for resizes, as this is used in the copy region */
+ if (!(WinPos.flags & SWP_NOSIZE))
{
- RGNOBJAPI_Unlock(VisRgn);
- NtGdiOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top);
+ VisBeforeJustClient = VIS_ComputeVisibleRegion(Window, TRUE, FALSE,
+ (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
+
+ if ( VisBeforeJustClient != NULL &&
+ REGION_Complexity(VisBeforeJustClient) == NULLREGION )
+ {
+ REGION_Delete(VisBeforeJustClient);
+ VisBeforeJustClient = NULL;
+ }
+ else if(VisBeforeJustClient)
+ {
+ REGION_bOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top);
+ }
}
}
}
if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
{
IntLinkHwnd(Window, WinPos.hwndInsertAfter);
-#if 0
- //// Fix bug 6751 & 7228 see WinPosDoOwnedPopups wine Fixme.
- PWND ParentWindow;
- PWND Sibling;
- PWND InsertAfterWindow;
-
- if ((ParentWindow = Window->spwndParent)) // Must have a Parent window!
- {
- //ERR("SetWindowPos has parent window.\n");
- 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;
- }
- }
- ////
-#endif
}
OldWindowRect = Window->rcWindow;
OldClientRect = Window->rcClient;
- //ERR("SetWindowPos OldWindowRect: %d %d %d %d\n", OldWindowRect.left,OldWindowRect.top,OldWindowRect.right,OldWindowRect.bottom);
- //ERR("SetWindowPos OldClientRect: %d %d %d %d\n", OldClientRect.left,OldClientRect.top,OldClientRect.right,OldClientRect.bottom);
if (NewClientRect.left != OldClientRect.left ||
NewClientRect.top != OldClientRect.top)
{
+ // Move child window if their parent is moved. Keep Child window relative to Parent...
WinPosInternalMoveWindow(Window,
NewClientRect.left - OldClientRect.left,
NewClientRect.top - OldClientRect.top);
Window->rcWindow = NewWindowRect;
Window->rcClient = NewClientRect;
- //ERR("SetWindowPos NewWindowRect: %d %d %d %d\n", NewWindowRect.left,NewWindowRect.top,NewWindowRect.right,NewWindowRect.bottom);
- //ERR("SetWindowPos NewClientRect: %d %d %d %d\n", NewClientRect.left,NewClientRect.top,NewClientRect.right,NewClientRect.bottom);
-
/* erase parent when hiding or resizing child */
if (WinPos.flags & SWP_HIDEWINDOW)
{
}
else if (WinPos.flags & SWP_SHOWWINDOW)
{
- if (Window->spwndParent == UserGetDesktopWindow())
+ if (Window->spwndParent == UserGetDesktopWindow() &&
+ Window->spwndOwner == NULL &&
+ (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
+ (Window->ExStyle & WS_EX_APPWINDOW)))
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)Window->head.h, 0);
Window->style |= WS_VISIBLE; //IntSetStyle( Window, WS_VISIBLE, 0 );
/* Determine the new visible region */
VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE,
(Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
- VisRgn = NULL;
if ( VisAfter != NULL &&
- (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) &&
- REGION_Complexity(VisRgn) == NULLREGION )
+ REGION_Complexity(VisAfter) == NULLREGION )
{
- RGNOBJAPI_Unlock(VisRgn);
- GreDeleteObject(VisAfter);
+ REGION_Delete(VisAfter);
VisAfter = NULL;
}
- else if(VisRgn)
+ else if(VisAfter)
{
- RGNOBJAPI_Unlock(VisRgn);
- NtGdiOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
+ REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
}
/*
((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) &&
!(Window->ExStyle & WS_EX_TRANSPARENT) )
{
- CopyRgn = IntSysCreateRectRgn(0, 0, 0, 0);
- RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
/*
* If this is (also) a window resize, the whole nonclient area
* we don't have to crop (can't take anything away from an empty
* region...)
*/
- if (!(WinPos.flags & SWP_NOSIZE) &&
- RgnType != ERROR &&
- RgnType != NULLREGION )
+
+ CopyRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
+ if (WinPos.flags & SWP_NOSIZE)
+ RgnType = IntGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
+ else if (VisBeforeJustClient != NULL)
{
- PROSRGNDATA pCopyRgn;
- RECTL ORect = OldClientRect;
- RECTL NRect = NewClientRect;
- RECTL_vOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect.top);
- RECTL_vOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect.top);
- RECTL_bIntersectRect(&CopyRect, &ORect, &NRect);
- pCopyRgn = RGNOBJAPI_Lock(CopyRgn, NULL);
- REGION_CropAndOffsetRegion(pCopyRgn, pCopyRgn, &CopyRect, NULL);
- RGNOBJAPI_Unlock(pCopyRgn);
+ RgnType = IntGdiCombineRgn(CopyRgn, VisAfter, VisBeforeJustClient, RGN_AND);
+ REGION_Delete(VisBeforeJustClient);
}
/* No use in copying bits which are in the update region. */
if (Window->hrgnUpdate != NULL)
{
- NtGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
- NtGdiCombineRgn(CopyRgn, CopyRgn, Window->hrgnUpdate, RGN_DIFF);
- NtGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
+ PREGION RgnUpdate = REGION_LockRgn(Window->hrgnUpdate);
+ if (RgnUpdate)
+ {
+ REGION_bOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
+ IntGdiCombineRgn(CopyRgn, CopyRgn, RgnUpdate, RGN_DIFF);
+ REGION_bOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
+ REGION_UnlockRgn(RgnUpdate);
+ }
}
/*
* there's nothing to copy. Also, it's no use copying bits onto
* themselves.
*/
- if ( (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(CopyRgn, NULL)) &&
- REGION_GetRgnBox(VisRgn, &CopyRect) == NULLREGION)
+ if (REGION_GetRgnBox(CopyRgn, &CopyRect) == NULLREGION)
{
/* Nothing to copy, clean up */
- RGNOBJAPI_Unlock(VisRgn);
- GreDeleteObject(CopyRgn);
+ REGION_Delete(CopyRgn);
CopyRgn = NULL;
}
else if (OldWindowRect.left != NewWindowRect.left ||
OldWindowRect.top != NewWindowRect.top)
{
- if(VisRgn)
- {
- RGNOBJAPI_Unlock(VisRgn);
- }
+ HRGN DcRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
+ PREGION DcRgnObj = REGION_LockRgn(DcRgn);
/*
* Small trick here: there is no function to bitblt a region. So
* Since NtUserGetDCEx takes ownership of the clip region, we need
* to create a copy of CopyRgn and pass that. We need CopyRgn later
*/
- NtGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
+ IntGdiCombineRgn(DcRgnObj, CopyRgn, NULL, RGN_COPY);
+ REGION_bOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top);
+ REGION_UnlockRgn(DcRgnObj);
Dc = UserGetDCEx( Window,
- CopyRgn,
+ DcRgn,
DCX_WINDOW|DCX_CACHE|DCX_INTERSECTRGN|DCX_CLIPSIBLINGS|DCX_KEEPCLIPRGN);
NtGdiBitBlt( Dc,
CopyRect.left, CopyRect.top,
UserReleaseDC(Window, Dc, FALSE);
IntValidateParent(Window, CopyRgn, FALSE);
- NtGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
- }
- else if(VisRgn)
- {
- RGNOBJAPI_Unlock(VisRgn);
+ GreDeleteObject(DcRgn);
}
}
else
/* We need to redraw what wasn't visible before */
if (VisAfter != NULL)
{
- DirtyRgn = IntSysCreateRectRgn(0, 0, 0, 0);
- if (CopyRgn != NULL)
+ PREGION DirtyRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
+ if (DirtyRgn)
{
- RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF);
- }
- else
- {
- RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, 0, RGN_COPY);
- }
- if (RgnType != ERROR && RgnType != NULLREGION)
- {
- /* old code
- NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
- IntInvalidateWindows( Window,
- DirtyRgn,
- RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
- }
- GreDeleteObject(DirtyRgn);
- */
-
- PWND Parent = Window->spwndParent;
-
- NtGdiOffsetRgn( DirtyRgn,
- Window->rcWindow.left,
- Window->rcWindow.top);
- if ( (Window->style & WS_CHILD) &&
- (Parent) &&
- !(Parent->style & WS_CLIPCHILDREN))
- {
- IntInvalidateWindows( Parent,
- DirtyRgn,
- RDW_ERASE | RDW_INVALIDATE);
- co_IntPaintWindows(Parent, RDW_ERASENOW, FALSE);
- }
- else
- {
+ if (CopyRgn != NULL)
+ {
+ RgnType = IntGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF);
+ }
+ else
+ {
+ RgnType = IntGdiCombineRgn(DirtyRgn, VisAfter, 0, RGN_COPY);
+ }
+ if (RgnType != ERROR && RgnType != NULLREGION)
+ {
+ /* old code
+ NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
IntInvalidateWindows( Window,
DirtyRgn,
- RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
- }
+ RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+ }
+ GreDeleteObject(DirtyRgn);
+ */
+
+ PWND Parent = Window->spwndParent;
+
+ REGION_bOffsetRgn( DirtyRgn,
+ Window->rcWindow.left,
+ Window->rcWindow.top);
+ if ( (Window->style & WS_CHILD) &&
+ (Parent) &&
+ !(Parent->style & WS_CLIPCHILDREN))
+ {
+ IntInvalidateWindows( Parent,
+ DirtyRgn,
+ RDW_ERASE | RDW_INVALIDATE);
+ co_IntPaintWindows(Parent, RDW_ERASENOW, FALSE);
+ }
+ else
+ {
+ IntInvalidateWindows( Window,
+ DirtyRgn,
+ RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+ }
+ }
+ REGION_Delete(DirtyRgn);
}
- GreDeleteObject(DirtyRgn);
}
if (CopyRgn != NULL)
{
- GreDeleteObject(CopyRgn);
+ REGION_Delete(CopyRgn);
}
/* Expose what was covered before but not covered anymore */
if (VisBefore != NULL)
{
- ExposedRgn = IntSysCreateRectRgn(0, 0, 0, 0);
- RgnType = NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY);
- NtGdiOffsetRgn( ExposedRgn,
- OldWindowRect.left - NewWindowRect.left,
- OldWindowRect.top - NewWindowRect.top);
+ PREGION ExposedRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
+ if (ExposedRgn)
+ {
+ RgnType = IntGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY);
+ REGION_bOffsetRgn(ExposedRgn,
+ OldWindowRect.left - NewWindowRect.left,
+ OldWindowRect.top - NewWindowRect.top);
- if (VisAfter != NULL)
- RgnType = NtGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
+ if (VisAfter != NULL)
+ RgnType = IntGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
- if (RgnType != ERROR && RgnType != NULLREGION)
- {
- co_VIS_WindowLayoutChanged(Window, ExposedRgn);
+ if (RgnType != ERROR && RgnType != NULLREGION)
+ {
+ co_VIS_WindowLayoutChanged(Window, ExposedRgn);
+ }
+ REGION_Delete(ExposedRgn);
}
- GreDeleteObject(ExposedRgn);
- GreDeleteObject(VisBefore);
+ REGION_Delete(VisBefore);
}
if (VisAfter != NULL)
{
- GreDeleteObject(VisAfter);
+ REGION_Delete(VisAfter);
}
}
{
co_IntSendMessageNoWait(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0);
}
- else
+ /* Do not allow setting if already active.
+ Fix A : wine msg test_SetParent:WmSetParentSeq_2:25 msg!
+ Recursion broke the tests.
+ */
+ else if ( pti->MessageQueue->spwndActive != Window ||
+ pti->MessageQueue != gpqForeground ) // This fixes the breakage at boot time caused by the above line!
{
- //ERR("SetWindowPos Set FG Window!\n");
- if (Window->state & WNDS_BEINGACTIVATED) // Inside SAW?
- co_IntSetActiveWindow(Window, FALSE, TRUE, FALSE); // Fixes Api AttachThreadInput tests.
- else
- co_IntSetForegroundWindow(Window); // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
+ // Inside SAW? Fixes Api AttachThreadInput tests.
+ TRACE("SetWindowPos Set FG Window! hWnd %p\n",WinPos.hwnd);
+ if (!(Window->state & WNDS_BEINGACTIVATED))
+ {
+ TRACE("SetWindowPos Set FG Window!\n");
+ // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
+ co_IntSetForegroundWindow(Window);
+ }
}
}
+ // Fix wine msg test_SetFocus, prevents sending WM_WINDOWPOSCHANGED.
+ if ( VisBefore == NULL &&
+ VisBeforeJustClient == NULL &&
+ !(Window->ExStyle & WS_EX_TOPMOST) &&
+ (WinPos.flags & SWP_AGG_STATUSFLAGS) == (SWP_AGG_NOPOSCHANGE & ~SWP_NOZORDER))
+ {
+ TRACE("No drawing, set no Z order and no redraw!\n");
+ WinPos.flags |= SWP_NOZORDER|SWP_NOREDRAW;
+ }
+
/* And last, send the WM_WINDOWPOSCHANGED message */
- TRACE("\tstatus flags = %04x\n", WinPos.flags & SWP_AGG_STATUSFLAGS);
+ TRACE("\tstatus hwnd %p flags = %04x\n",Window?Window->head.h:NULL,WinPos.flags & SWP_AGG_STATUSFLAGS);
if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
{
WinPos.y = NewWindowRect.top;
WinPos.cx = NewWindowRect.right - NewWindowRect.left;
WinPos.cy = NewWindowRect.bottom - NewWindowRect.top;
+ TRACE("WM_WINDOWPOSCHANGED hwnd %p Flags %04x\n",WinPos.hwnd,WinPos.flags);
co_IntSendMessageNoWait(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos);
}
IntEngWindowChanged(Wnd, WOC_RGN_CLIENT);
}
+/*
+ ShowWindow does not set SWP_FRAMECHANGED!!! Fix wine msg test_SetParent:WmSetParentSeq_2:23 wParam bits!
+ */
BOOLEAN FASTCALL
co_WinPosShowWindow(PWND Wnd, INT Cmd)
{
LONG style;
PWND Parent;
PTHREADINFO pti;
- // HRGN VisibleRgn;
- //ERR("co_WinPosShowWindow START\n");
+ //HRGN VisibleRgn;
BOOL ShowOwned = FALSE;
+ BOOL FirstTime = FALSE;
ASSERT_REFS_CO(Wnd);
-
+ //KeRosDumpStackFrames(NULL, 20);
pti = PsGetCurrentThreadWin32Thread();
WasVisible = (Wnd->style & WS_VISIBLE) != 0;
style = Wnd->style;
+ TRACE("co_WinPosShowWindow START hwnd %p Cmd %d usicmd %u\n",
+ Wnd->head.h, Cmd, pti->ppi->usi.wShowWindow);
+
+ if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
+ {
+ if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
+ {
+ if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
+ {
+ if (Wnd->spwndOwner == NULL)
+ {
+ if ( Cmd == SW_SHOWNORMAL || Cmd == SW_SHOW)
+ {
+ Cmd = SW_SHOWDEFAULT;
+ }
+ FirstTime = TRUE;
+ ERR("co_WPSW FT 1\n");
+ }
+ }
+ }
+ }
+
+ if ( Cmd == SW_SHOWDEFAULT )
+ {
+ if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
+ {
+ Cmd = pti->ppi->usi.wShowWindow;
+ FirstTime = TRUE;
+ ERR("co_WPSW FT 2\n");
+ }
+ }
+
+ if (FirstTime)
+ {
+ pti->ppi->usi.dwFlags &= ~(STARTF_USEPOSITION|STARTF_USESIZE|STARTF_USESHOWWINDOW);
+ }
+
switch (Cmd)
{
case SW_HIDE:
if (!WasVisible)
{
//ERR("co_WinPosShowWindow Exit Bad\n");
- return(FALSE);
+ return FALSE;
}
Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if (Wnd != pti->MessageQueue->spwndActive)
if (!(style & WS_MINIMIZE))
{
IntShowOwnedPopups(Wnd, FALSE );
-
// Fix wine Win test_SetFocus todo #1 & #2,
if (Cmd == SW_SHOWMINIMIZED)
{
co_UserSetFocus(0);
}
- Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos) |
- SWP_FRAMECHANGED;
+ Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos);
EventMsg = EVENT_SYSTEM_MINIMIZESTART;
}
else
{
- if (!WasVisible)
- {
- Swp |= SWP_FRAMECHANGED;
- }
- else ////
+ if (WasVisible)
{
//ERR("co_WinPosShowWindow Exit Good\n");
return TRUE;
{
ShowOwned = TRUE;
- Swp |= co_WinPosMinMaximize(Wnd, SW_MAXIMIZE, &NewPos) |
- SWP_FRAMECHANGED;
+ Swp |= co_WinPosMinMaximize(Wnd, SW_MAXIMIZE, &NewPos);
EventMsg = EVENT_SYSTEM_MINIMIZEEND;
}
else
{
- if (!WasVisible)
- {
- Swp |= SWP_FRAMECHANGED;
- }
- else ////
+ if (WasVisible)
{
//ERR("co_WinPosShowWindow Exit Good 1\n");
return TRUE;
if (!WasVisible) Swp |= SWP_SHOWWINDOW;
if (style & (WS_MINIMIZE | WS_MAXIMIZE))
{
- Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos) |
- SWP_FRAMECHANGED;
-
+ Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos);
if (style & WS_MINIMIZE) EventMsg = EVENT_SYSTEM_MINIMIZEEND;
}
else
{
- if (!WasVisible)
- {
- Swp |= SWP_FRAMECHANGED;
- }
- else ////
+ if (WasVisible)
{
//ERR("co_WinPosShowWindow Exit Good 3\n");
return TRUE;
if ((ShowFlag != WasVisible || Cmd == SW_SHOWNA) && Cmd != SW_SHOWMAXIMIZED && !(Swp & SWP_STATECHANGED))
{
co_IntSendMessageNoWait(Wnd->head.h, WM_SHOWWINDOW, ShowFlag, 0);
- if (!(Wnd->state2 & WNDS2_WIN31COMPAT))
+#if 0 // Fix wine msg test_SetParent:WmSetParentSeq_1:2
+ if (!(Wnd->state2 & WNDS2_WIN31COMPAT)) // <------------- XP sets this bit!
co_IntSendMessageNoWait(Wnd->head.h, WM_SETVISIBLE, ShowFlag, 0);
+#endif
if (!VerifyWnd(Wnd)) return WasVisible;
}
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
}
-#if 0 // Explorer issues with common controls. Someone does not know how CS_SAVEBITS works.
+#if 0 // Explorer issues with common controls? Someone does not know how CS_SAVEBITS works.
+ // Breaks startup and shutdown active window...
if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
Wnd->pcls->style & CS_SAVEBITS &&
((Cmd == SW_SHOW) || (Cmd == SW_NORMAL)))
if (IsChildVisible(Wnd) || Swp & SWP_STATECHANGED)
{
- TRACE("Child is Vis %s or State changed %s. ShowFlag %s\n",
+ TRACE("Child is Vis %s or State changed %s. ShowFlag %s Swp %04x\n",
(IsChildVisible(Wnd) ? "TRUE" : "FALSE"), (Swp & SWP_STATECHANGED ? "TRUE" : "FALSE"),
- (ShowFlag ? "TRUE" : "FALSE"));
+ (ShowFlag ? "TRUE" : "FALSE"),LOWORD(Swp));
co_WinPosSetWindowPos( Wnd,
0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP,
NewPos.left,
NewPos.top,
- NewPos.right, //NewPos.right - NewPos.left,
- NewPos.bottom, //NewPos.bottom - NewPos.top,
+ NewPos.right, // NewPos.right - NewPos.left, when minimized and restore, the window becomes smaller.
+ NewPos.bottom,// NewPos.bottom - NewPos.top,
LOWORD(Swp));
}
else
{
if ( Wnd->spwndParent == UserGetDesktopWindow())
{
- if(!ActivateOtherWindowMin(Wnd))
+ if (!ActivateOtherWindowMin(Wnd))
+ {
co_WinPosActivateOtherWindow(Wnd);
+ }
}
else
+ {
co_WinPosActivateOtherWindow(Wnd);
+ }
}
/* Revert focus to parent */
if (Wnd->spwndParent == UserGetDesktopWindow()) Parent = 0;
co_UserSetFocus(Parent);
}
+ // Hide, just return.
+ if (Cmd == SW_HIDE) return WasVisible;
}
/* FIXME: Check for window destruction. */
if (!(style & WS_CHILD)) co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_ACTIVATE, WA_ACTIVE, 0);
}
//ERR("co_WinPosShowWindow EXIT\n");
- return(WasVisible);
+ return WasVisible;
}
-static
-PWND FASTCALL
+static PWND
co_WinPosSearchChildren(
- PWND ScopeWin,
- POINT *Point,
- USHORT *HitTest
+ IN PWND ScopeWin,
+ IN POINT *Point,
+ IN OUT USHORT *HitTest,
+ IN BOOL Ignore
)
{
- PWND pwndChild;
HWND *List, *phWnd;
+ PWND pwndChild = NULL;
+ /* not visible */
if (!(ScopeWin->style & WS_VISIBLE))
{
return NULL;
}
- if ((ScopeWin->style & WS_DISABLED))
+ /* not in window or in window region */
+ if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
{
return NULL;
}
- if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
+ /* transparent */
+ if ((ScopeWin->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == (WS_EX_LAYERED|WS_EX_TRANSPARENT))
{
return NULL;
}
- UserReferenceObject(ScopeWin);
+ if (!Ignore && (ScopeWin->style & WS_DISABLED))
+ { /* disabled child */
+ if ((ScopeWin->style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return NULL;
+ /* process the hit error */
+ *HitTest = HTERROR;
+ return ScopeWin;
+ }
- if ( RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
+ /* not minimized and check if point is inside the window */
+ if (!(ScopeWin->style & WS_MINIMIZE) &&
+ RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
{
+ UserReferenceObject(ScopeWin);
+
List = IntWinListChildren(ScopeWin);
- if(List)
+ if (List)
{
for (phWnd = List; *phWnd; ++phWnd)
{
continue;
}
- pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest);
+ pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest, Ignore);
- if(pwndChild != NULL)
+ if (pwndChild != NULL)
{
/* We found a window. Don't send any more WM_NCHITTEST messages */
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
}
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
}
+ UserDereferenceObject(ScopeWin);
}
if (ScopeWin->head.pti == PsGetCurrentThreadWin32Thread())
{
- *HitTest = (USHORT)co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0,
- MAKELONG(Point->x, Point->y));
+ *HitTest = (USHORT)co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0, MAKELONG(Point->x, Point->y));
+
if ((*HitTest) == (USHORT)HTTRANSPARENT)
{
- UserDereferenceObject(ScopeWin);
return NULL;
}
}
else
- *HitTest = HTCLIENT;
+ {
+ if (*HitTest == HTNOWHERE && pwndChild == NULL) *HitTest = HTCLIENT;
+ }
return ScopeWin;
}
-PWND FASTCALL
-co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest)
+PWND APIENTRY
+co_WinPosWindowFromPoint(
+ IN PWND ScopeWin,
+ IN POINT *WinPoint,
+ IN OUT USHORT* HitTest,
+ IN BOOL Ignore)
{
PWND Window;
POINT Point = *WinPoint;
ASSERT_REFS_CO(ScopeWin);
UserRefObjectCo(ScopeWin, &Ref);
- Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest);
+ Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest, Ignore);
UserDerefObjectCo(ScopeWin);
if (Window)
}
Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
RETURN( FALSE);
}
- if(Safepl.length != sizeof(WINDOWPLACEMENT))
- {
- RETURN( FALSE);
- }
+
+ Safepl.length = sizeof(WINDOWPLACEMENT);
IntGetWindowPlacement(Wnd, &Safepl);
Status = MmCopyToCaller(lpwndpl, &Safepl, sizeof(WINDOWPLACEMENT));
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
RETURN( FALSE);
HRGN hRgn,
BOOL bRedraw)
{
- HRGN hrgnCopy;
+ HRGN hrgnCopy = NULL;
PWND Window;
INT flags = (SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE);
BOOLEAN Ret = FALSE;
{
if (GreIsHandleValid(hRgn))
{
- hrgnCopy = IntSysCreateRectRgn(0, 0, 0, 0);
+ hrgnCopy = NtGdiCreateRectRgn(0, 0, 0, 0);
/* The coordinates of a window's window region are relative to the
upper-left corner of the window, not the client area of the window. */
NtGdiCombineRgn( hrgnCopy, hRgn, 0, RGN_COPY);
else
RETURN( 0);
}
- else
- {
- hrgnCopy = NULL;
- }
if (Window->hrgnClip)
{
DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
- TRACE("Enter NtUserShowWindow\n");
+ TRACE("Enter NtUserShowWindow hWnd %p SW_ %d\n",hWnd, nCmdShow);
UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
UserRefObjectCo(DesktopWindow, &Ref);
//pti = PsGetCurrentThreadWin32Thread();
- Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest);
+ Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest, FALSE);
if (Window)
{
RETURN( NULL);
CLEANUP:
- if (Window) UserDereferenceObject(Window);
if (DesktopWindow) UserDerefObjectCo(DesktopWindow);
TRACE("Leave NtUserWindowFromPoint, ret=%p\n", _ret_);