2010-01-12 05:25:22 +00:00
|
|
|
/*
|
2002-05-06 22:20:32 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Windows
|
2011-03-20 01:09:15 +00:00
|
|
|
* FILE: subsystems/win32/win32k/ntuser/window.c
|
2002-05-06 22:20:32 +00:00
|
|
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
*/
|
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2011-08-21 12:38:52 +00:00
|
|
|
DBG_DEFAULT_CHANNEL(UserWinpos);
|
2002-05-06 22:20:32 +00:00
|
|
|
|
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
|
|
|
#define MINMAX_NOSWP (0x00010000)
|
|
|
|
|
2003-08-01 14:38:51 +00:00
|
|
|
#define SWP_EX_NOCOPY 0x0001
|
2002-07-04 19:56:38 +00:00
|
|
|
#define SWP_EX_PAINTSELF 0x0002
|
|
|
|
|
2003-08-01 14:38:51 +00:00
|
|
|
#define SWP_AGG_NOGEOMETRYCHANGE \
|
|
|
|
(SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
|
|
|
|
#define SWP_AGG_NOPOSCHANGE \
|
|
|
|
(SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
|
|
|
|
#define SWP_AGG_STATUSFLAGS \
|
|
|
|
(SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
|
|
|
|
|
2011-12-10 06:08:29 +00:00
|
|
|
#define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1)
|
2011-12-10 07:41:56 +00:00
|
|
|
#define PLACE_MIN 0x0001
|
|
|
|
#define PLACE_MAX 0x0002
|
|
|
|
#define PLACE_RECT 0x0004
|
2011-12-10 06:08:29 +00:00
|
|
|
|
2002-05-06 22:20:32 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2003-12-23 21:33:25 +00:00
|
|
|
BOOL FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
IntGetClientOrigin(PWND Window OPTIONAL, LPPOINT Point)
|
2002-09-17 23:43:29 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
Window = Window ? Window : UserGetWindowObject(IntGetDesktopWindow());
|
|
|
|
if (Window == NULL)
|
|
|
|
{
|
2002-10-31 00:03:31 +00:00
|
|
|
Point->x = Point->y = 0;
|
2003-12-23 21:33:25 +00:00
|
|
|
return FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2010-10-11 03:41:41 +00:00
|
|
|
Point->x = Window->rcClient.left;
|
|
|
|
Point->y = Window->rcClient.top;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
2003-12-23 21:33:25 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
/*******************************************************************
|
|
|
|
* can_activate_window
|
|
|
|
*
|
|
|
|
* Check if we can activate the specified window.
|
|
|
|
*/
|
2007-10-19 23:21:45 +00:00
|
|
|
static
|
2010-10-11 03:41:41 +00:00
|
|
|
BOOL FASTCALL can_activate_window( PWND Wnd OPTIONAL)
|
2005-09-09 00:25:52 +00:00
|
|
|
{
|
|
|
|
LONG style;
|
|
|
|
|
|
|
|
if (!Wnd) return FALSE;
|
2010-10-11 03:41:41 +00:00
|
|
|
|
|
|
|
style = Wnd->style;
|
2007-10-19 23:21:45 +00:00
|
|
|
if (!(style & WS_VISIBLE) &&
|
2010-10-11 03:41:41 +00:00
|
|
|
Wnd->head.pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
|
2010-05-08 15:49:02 +00:00
|
|
|
if ((style & WS_MINIMIZE) &&
|
2010-10-11 03:41:41 +00:00
|
|
|
Wnd->head.pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
|
2005-09-09 00:25:52 +00:00
|
|
|
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
|
2010-05-08 15:49:02 +00:00
|
|
|
return TRUE;
|
|
|
|
/* FIXME: This window could be disable because the child that closed
|
|
|
|
was a popup. */
|
|
|
|
//return !(style & WS_DISABLED);
|
2005-09-09 00:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-23 09:07:54 +00:00
|
|
|
/*******************************************************************
|
|
|
|
* WinPosActivateOtherWindow
|
|
|
|
*
|
|
|
|
* Activates window other than pWnd.
|
|
|
|
*/
|
2003-12-02 19:58:54 +00:00
|
|
|
VOID FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosActivateOtherWindow(PWND Wnd)
|
2002-07-17 21:04:57 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND WndTo = NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND Fg;
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
ASSERT_REFS_CO(Wnd);
|
2007-11-15 22:08:13 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (IntIsDesktopWindow(Wnd))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
IntSetFocusMessageQueue(NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this is popup window, try to activate the owner first. */
|
2010-10-11 03:41:41 +00:00
|
|
|
if ((Wnd->style & WS_POPUP) && (WndTo = Wnd->spwndOwner))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2005-09-11 14:48:32 +00:00
|
|
|
WndTo = UserGetAncestor( WndTo, GA_ROOT );
|
|
|
|
if (can_activate_window(WndTo)) goto done;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Pick a next top-level window. */
|
|
|
|
/* FIXME: Search for non-tooltip windows first. */
|
2010-10-11 03:41:41 +00:00
|
|
|
WndTo = Wnd;
|
2005-09-11 14:48:32 +00:00
|
|
|
for (;;)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2009-12-14 05:02:56 +00:00
|
|
|
if (!(WndTo = WndTo->spwndNext)) break;
|
2005-09-11 14:48:32 +00:00
|
|
|
if (can_activate_window( WndTo )) break;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2005-07-26 17:46:48 +00:00
|
|
|
|
|
|
|
done:
|
2005-09-07 20:59:26 +00:00
|
|
|
|
2005-10-15 13:22:13 +00:00
|
|
|
if (WndTo) UserRefObjectCo(WndTo, &Ref);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
Fg = UserGetForegroundWindow();
|
2011-12-14 04:07:06 +00:00
|
|
|
if ((!Fg || Wnd->head.h == Fg) && WndTo) // FIXME: Ok if WndTo is NULL??
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-14 04:07:06 +00:00
|
|
|
/* FIXME: Wine can pass WndTo = NULL to co_IntSetForegroundWindow. Hmm... */
|
2005-09-11 14:48:32 +00:00
|
|
|
if (co_IntSetForegroundWindow(WndTo))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2005-09-11 14:48:32 +00:00
|
|
|
UserDerefObjectCo(WndTo);
|
2005-09-07 21:25:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-14 04:07:06 +00:00
|
|
|
if (!co_IntSetActiveWindow(WndTo)) /* Ok for WndTo to be NULL here */
|
2005-09-07 21:25:42 +00:00
|
|
|
co_IntSetActiveWindow(0);
|
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
if (WndTo) UserDerefObjectCo(WndTo);
|
2002-07-17 21:04:57 +00:00
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
WinPosShowIconTitle( PWND pWnd, BOOL bShow )
|
|
|
|
{
|
|
|
|
HICON hIcon;
|
|
|
|
if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return FALSE;
|
|
|
|
if (!hIcon) hIcon = pWnd->pcls->hIconSm;
|
|
|
|
if (!hIcon) hIcon = pWnd->pcls->hIcon;
|
|
|
|
if (!hIcon) return FALSE;
|
|
|
|
|
|
|
|
if ( bShow )
|
|
|
|
{
|
|
|
|
// FIXME: Draw ICON!
|
|
|
|
}
|
|
|
|
else if (hIcon)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-18 03:12:01 +00:00
|
|
|
|
|
|
|
UINT
|
|
|
|
FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosArrangeIconicWindows(PWND parent)
|
2005-07-18 03:12:01 +00:00
|
|
|
{
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL rectParent;
|
2011-12-16 01:49:10 +00:00
|
|
|
INT i, x, y, xspacing, yspacing, sx, sy;
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND *List = IntWinListChildren(parent);
|
|
|
|
|
|
|
|
ASSERT_REFS_CO(parent);
|
|
|
|
|
2011-09-18 12:33:38 +00:00
|
|
|
/* Check if we found any children */
|
|
|
|
if(List == NULL)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
IntGetClientRect( parent, &rectParent );
|
|
|
|
x = rectParent.left;
|
|
|
|
y = rectParent.bottom;
|
|
|
|
|
2011-12-16 01:49:10 +00:00
|
|
|
xspacing = (UserGetSystemMetrics(SM_CXMINSPACING)/2)+UserGetSystemMetrics(SM_CXBORDER);
|
|
|
|
yspacing = (UserGetSystemMetrics(SM_CYMINSPACING)/2)+UserGetSystemMetrics(SM_CYBORDER);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("X:%d Y:%d XS:%d YS:%d\n",x,y,xspacing,yspacing);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
for( i = 0; List[i]; i++)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Child;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (!(Child = UserGetWindowObject(List[i])))
|
2005-09-07 21:25:42 +00:00
|
|
|
continue;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if((Child->style & WS_MINIMIZE) != 0 )
|
2005-07-18 03:12:01 +00:00
|
|
|
{
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2010-10-11 03:41:41 +00:00
|
|
|
UserRefObjectCo(Child, &Ref);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-16 01:49:10 +00:00
|
|
|
sx = x + UserGetSystemMetrics(SM_CXBORDER);
|
|
|
|
sy = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
|
|
|
|
|
|
|
|
co_WinPosSetWindowPos( Child, 0, sx, sy, 0, 0,
|
2011-12-10 07:41:56 +00:00
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-16 01:49:10 +00:00
|
|
|
Child->InternalPos.IconPos.x = sx;
|
|
|
|
Child->InternalPos.IconPos.y = sy;
|
|
|
|
Child->InternalPos.flags |= WPF_MININIT;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
UserDerefObjectCo(Child);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-16 01:49:10 +00:00
|
|
|
if (x <= rectParent.right - UserGetSystemMetrics(SM_CXMINSPACING))
|
2005-09-07 21:25:42 +00:00
|
|
|
x += xspacing;
|
2005-07-18 03:12:01 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
x = rectParent.left;
|
|
|
|
y -= yspacing;
|
|
|
|
}
|
2011-12-16 01:49:10 +00:00
|
|
|
TRACE("X:%d Y:%d\n",x,y);
|
2005-07-18 03:12:01 +00:00
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
ExFreePool(List);
|
|
|
|
return yspacing;
|
2005-07-18 03:12:01 +00:00
|
|
|
}
|
|
|
|
|
2008-12-03 17:36:23 +00:00
|
|
|
static VOID FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
WinPosFindIconPos(PWND Window, POINT *Pos)
|
2002-07-04 19:56:38 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
RECT rect, rectParent;
|
|
|
|
PWND pwndChild, pwndParent;
|
|
|
|
HRGN hrgn, tmp;
|
|
|
|
int xspacing, yspacing;
|
|
|
|
|
|
|
|
pwndParent = Window->spwndParent;
|
|
|
|
if (pwndParent == UserGetDesktopWindow())
|
|
|
|
{
|
|
|
|
/* ReactOS doesn't support iconic minimize to desktop */
|
|
|
|
Pos->x = Pos->y = -32000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
IntGetClientRect( pwndParent, &rectParent );
|
|
|
|
if ((Pos->x >= rectParent.left) && (Pos->x + UserGetSystemMetrics(SM_CXICON) < rectParent.right) &&
|
|
|
|
(Pos->y >= rectParent.top) && (Pos->y + UserGetSystemMetrics(SM_CYICON) < rectParent.bottom))
|
|
|
|
return; /* The icon already has a suitable position */
|
|
|
|
|
|
|
|
xspacing = UserGetSystemMetrics(SM_CXICONSPACING);
|
|
|
|
yspacing = UserGetSystemMetrics(SM_CYICONSPACING);
|
|
|
|
|
|
|
|
/* Check if another icon already occupies this spot */
|
|
|
|
/* FIXME: this is completely inefficient */
|
|
|
|
|
|
|
|
hrgn = IntSysCreateRectRgn( 0, 0, 0, 0 );
|
|
|
|
tmp = IntSysCreateRectRgn( 0, 0, 0, 0 );
|
|
|
|
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->spwndParent )
|
|
|
|
{
|
|
|
|
PWND Parent = pwndChild->spwndParent;
|
|
|
|
rect.left = rect.top = 0;
|
|
|
|
rect.right = Parent->rcWindow.right - Parent->rcWindow.left;
|
|
|
|
rect.bottom = Parent->rcWindow.bottom - Parent->rcWindow.top;
|
|
|
|
NtGdiSetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
|
|
|
|
NtGdiCombineRgn( hrgn, hrgn, tmp, RGN_OR );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GreDeleteObject( tmp );
|
|
|
|
|
|
|
|
for (rect.bottom = rectParent.bottom; rect.bottom >= yspacing; rect.bottom -= yspacing)
|
|
|
|
{
|
|
|
|
for (rect.left = rectParent.left; rect.left <= rectParent.right - xspacing; rect.left += xspacing)
|
|
|
|
{
|
|
|
|
rect.right = rect.left + xspacing;
|
|
|
|
rect.top = rect.bottom - yspacing;
|
|
|
|
if (!IntRectInRegion( hrgn, &rect ))
|
|
|
|
{
|
|
|
|
/* No window was found, so it's OK for us */
|
|
|
|
Pos->x = rect.left + (xspacing - UserGetSystemMetrics(SM_CXICON)) / 2;
|
|
|
|
Pos->y = rect.top + (yspacing - UserGetSystemMetrics(SM_CYICON)) / 2;
|
|
|
|
GreDeleteObject( hrgn );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GreDeleteObject( hrgn );
|
|
|
|
Pos->x = Pos->y = 0;
|
|
|
|
return;
|
2002-07-04 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
2007-11-21 05:35:33 +00:00
|
|
|
VOID FASTCALL
|
2011-12-10 07:41:56 +00:00
|
|
|
WinPosInitInternalPos(PWND Wnd, RECTL *RestoreRect)
|
2002-07-04 19:56:38 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
POINT Size;
|
|
|
|
RECTL Rect = *RestoreRect;
|
|
|
|
|
|
|
|
if (Wnd->spwndParent != UserGetDesktopWindow())
|
|
|
|
{
|
|
|
|
RECTL_vOffsetRect(&Rect,
|
|
|
|
-Wnd->spwndParent->rcClient.left,
|
|
|
|
-Wnd->spwndParent->rcClient.top);
|
|
|
|
}
|
|
|
|
|
|
|
|
Size.x = Rect.left;
|
|
|
|
Size.y = Rect.top;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2007-11-21 05:35:33 +00:00
|
|
|
if (!Wnd->InternalPosInitialized)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
// FIXME: Use check point Atom..
|
|
|
|
Wnd->InternalPos.flags = 0;
|
|
|
|
Wnd->InternalPos.MaxPos.x = Wnd->InternalPos.MaxPos.y = -1;
|
|
|
|
Wnd->InternalPos.IconPos.x = Wnd->InternalPos.IconPos.y = -1;
|
|
|
|
Wnd->InternalPos.NormalRect = Rect;
|
|
|
|
Wnd->InternalPosInitialized = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Wnd->style & WS_MINIMIZE)
|
|
|
|
{
|
|
|
|
Wnd->InternalPos.IconPos = Size;
|
|
|
|
Wnd->InternalPos.flags |= WPF_MININIT;
|
|
|
|
}
|
|
|
|
else if (Wnd->style & WS_MAXIMIZE)
|
|
|
|
{
|
|
|
|
Wnd->InternalPos.flags |= WPF_MAXINIT;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if ( Wnd->spwndParent == Wnd->head.rpdesk->pDeskInfo->spwnd )
|
2004-02-24 01:30:58 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
if (Wnd->state & WNDS_MAXIMIZESTOMONITOR)
|
|
|
|
{
|
|
|
|
Wnd->InternalPos.flags &= ~WPF_MAXINIT;
|
|
|
|
Wnd->InternalPos.MaxPos.x = Wnd->InternalPos.MaxPos.y = -1;
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
else
|
2011-12-10 07:41:56 +00:00
|
|
|
{
|
|
|
|
RECTL WorkArea;
|
|
|
|
PMONITOR pmonitor = IntMonitorFromRect(&Rect, MONITOR_DEFAULTTOPRIMARY );
|
|
|
|
|
|
|
|
// FIXME: support DPI aware, rcWorkDPI/Real etc..
|
|
|
|
if (!(Wnd->style & WS_MAXIMIZEBOX) || (Wnd->state & WNDS_HASCAPTION) || pmonitor->cFullScreen)
|
|
|
|
WorkArea = pmonitor->rcMonitor;
|
|
|
|
else
|
|
|
|
WorkArea = pmonitor->rcWork;
|
|
|
|
|
|
|
|
Wnd->InternalPos.MaxPos.x = Rect.left - WorkArea.left;
|
|
|
|
Wnd->InternalPos.MaxPos.y = Rect.top - WorkArea.top;
|
|
|
|
TRACE("WinPosIP 2 X %d Y %d\n",Wnd->InternalPos.MaxPos.x,Wnd->InternalPos.MaxPos.y);
|
|
|
|
}
|
2004-02-24 01:30:58 +00:00
|
|
|
}
|
2003-12-26 01:14:10 +00:00
|
|
|
else
|
2011-12-10 07:41:56 +00:00
|
|
|
Wnd->InternalPos.MaxPos = Size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Wnd->InternalPos.NormalRect = Rect;
|
|
|
|
}
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
IntGetWindowPlacement(PWND Wnd, WINDOWPLACEMENT *lpwndpl)
|
|
|
|
{
|
|
|
|
if (!Wnd) return FALSE;
|
2007-11-21 05:35:33 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if(lpwndpl->length != sizeof(WINDOWPLACEMENT))
|
|
|
|
{
|
|
|
|
return FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2011-12-10 07:41:56 +00:00
|
|
|
|
|
|
|
lpwndpl->flags = 0;
|
|
|
|
|
|
|
|
WinPosInitInternalPos(Wnd, &Wnd->rcWindow);
|
|
|
|
|
|
|
|
lpwndpl->showCmd = SW_HIDE;
|
|
|
|
|
|
|
|
if ( Wnd->style & WS_MINIMIZE )
|
|
|
|
lpwndpl->showCmd = SW_SHOWMINIMIZED;
|
|
|
|
else
|
|
|
|
lpwndpl->showCmd = ( Wnd->style & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
|
|
|
|
|
|
|
|
lpwndpl->rcNormalPosition = Wnd->InternalPos.NormalRect;
|
|
|
|
|
|
|
|
if (Wnd->InternalPos.flags & WPF_MININIT) // Return if it was set!
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
lpwndpl->ptMinPosition.x = Wnd->InternalPos.IconPos.x;
|
|
|
|
lpwndpl->ptMinPosition.y = Wnd->InternalPos.IconPos.y;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2011-12-10 07:41:56 +00:00
|
|
|
else
|
|
|
|
lpwndpl->ptMinPosition.x = lpwndpl->ptMinPosition.y = -1;
|
|
|
|
|
|
|
|
if ( Wnd->InternalPos.flags & WPF_MAXINIT && // Return if set and not maximized to monitor!
|
|
|
|
!(Wnd->state & WNDS_MAXIMIZESTOMONITOR))
|
|
|
|
{
|
|
|
|
lpwndpl->ptMaxPosition.x = Wnd->InternalPos.MaxPos.x;
|
|
|
|
lpwndpl->ptMaxPosition.y = Wnd->InternalPos.MaxPos.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
lpwndpl->ptMaxPosition.x = lpwndpl->ptMaxPosition.y = -1;
|
|
|
|
|
|
|
|
if ( Wnd->spwndParent == Wnd->head.rpdesk->pDeskInfo->spwnd &&
|
|
|
|
!(Wnd->ExStyle & WS_EX_TOOLWINDOW))
|
|
|
|
{
|
|
|
|
PMONITOR pmonitor = IntMonitorFromRect(&lpwndpl->rcNormalPosition, MONITOR_DEFAULTTOPRIMARY );
|
|
|
|
|
|
|
|
// FIXME: support DPI aware, rcWorkDPI/Real etc..
|
|
|
|
if (Wnd->InternalPos.flags & WPF_MININIT)
|
|
|
|
{
|
|
|
|
lpwndpl->ptMinPosition.x -= (pmonitor->rcWork.left - pmonitor->rcMonitor.left);
|
|
|
|
lpwndpl->ptMinPosition.y -= (pmonitor->rcWork.top - pmonitor->rcMonitor.top);
|
|
|
|
}
|
|
|
|
RECTL_vOffsetRect(&lpwndpl->rcNormalPosition,
|
|
|
|
pmonitor->rcMonitor.left - pmonitor->rcWork.left,
|
|
|
|
pmonitor->rcMonitor.top - pmonitor->rcWork.top);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED || Wnd->style & WS_MAXIMIZE )
|
|
|
|
lpwndpl->flags |= WPF_RESTORETOMAXIMIZED;
|
|
|
|
|
|
|
|
if ( ((Wnd->style & (WS_CHILD|WS_POPUP)) == WS_CHILD) && Wnd->InternalPos.flags & WPF_SETMINPOSITION)
|
|
|
|
lpwndpl->flags |= WPF_SETMINPOSITION;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure the specified rect is visible on screen */
|
|
|
|
static void make_rect_onscreen( RECT *rect )
|
|
|
|
{
|
|
|
|
PMONITOR pmonitor = IntMonitorFromRect( rect, MONITOR_DEFAULTTONEAREST ); // Wine uses this.
|
|
|
|
|
|
|
|
// FIXME: support DPI aware, rcWorkDPI/Real etc..
|
|
|
|
if (!pmonitor) return;
|
|
|
|
/* FIXME: map coordinates from rcWork to rcMonitor */
|
|
|
|
if (rect->right <= pmonitor->rcWork.left)
|
|
|
|
{
|
|
|
|
rect->right += pmonitor->rcWork.left - rect->left;
|
|
|
|
rect->left = pmonitor->rcWork.left;
|
|
|
|
}
|
|
|
|
else if (rect->left >= pmonitor->rcWork.right)
|
|
|
|
{
|
|
|
|
rect->left += pmonitor->rcWork.right - rect->right;
|
|
|
|
rect->right = pmonitor->rcWork.right;
|
|
|
|
}
|
|
|
|
if (rect->bottom <= pmonitor->rcWork.top)
|
|
|
|
{
|
|
|
|
rect->bottom += pmonitor->rcWork.top - rect->top;
|
|
|
|
rect->top = pmonitor->rcWork.top;
|
|
|
|
}
|
|
|
|
else if (rect->top >= pmonitor->rcWork.bottom)
|
|
|
|
{
|
|
|
|
rect->top += pmonitor->rcWork.bottom - rect->bottom;
|
|
|
|
rect->bottom = pmonitor->rcWork.bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure the specified point is visible on screen */
|
|
|
|
static void make_point_onscreen( POINT *pt )
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
RECTL_vSetRect( &rect, pt->x, pt->y, pt->x + 1, pt->y + 1 );
|
|
|
|
make_rect_onscreen( &rect );
|
|
|
|
pt->x = rect.left;
|
|
|
|
pt->y = rect.top;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL FASTCALL
|
|
|
|
IntSetWindowPlacement(PWND Wnd, WINDOWPLACEMENT *wpl, UINT Flags)
|
|
|
|
{
|
|
|
|
BOOL sAsync;
|
|
|
|
UINT SWP_Flags;
|
|
|
|
|
|
|
|
if ( Flags & PLACE_MIN) make_point_onscreen( &wpl->ptMinPosition );
|
|
|
|
if ( Flags & PLACE_MAX) make_point_onscreen( &wpl->ptMaxPosition );
|
|
|
|
if ( Flags & PLACE_RECT) make_rect_onscreen( &wpl->rcNormalPosition );
|
|
|
|
|
|
|
|
if (!Wnd || Wnd == Wnd->head.rpdesk->pDeskInfo->spwnd) return FALSE;
|
|
|
|
|
|
|
|
if ( Flags & PLACE_MIN ) Wnd->InternalPos.IconPos = wpl->ptMinPosition;
|
|
|
|
if ( Flags & PLACE_MAX ) Wnd->InternalPos.MaxPos = wpl->ptMaxPosition;
|
|
|
|
if ( Flags & PLACE_RECT) Wnd->InternalPos.NormalRect = wpl->rcNormalPosition;
|
|
|
|
|
|
|
|
SWP_Flags = SWP_NOZORDER | SWP_NOACTIVATE | ((wpl->flags & WPF_ASYNCWINDOWPLACEMENT) ? SWP_ASYNCWINDOWPOS : 0);
|
|
|
|
|
|
|
|
if (Wnd->style & WS_MINIMIZE )
|
|
|
|
{
|
|
|
|
if (Flags & PLACE_MIN)
|
|
|
|
{
|
|
|
|
co_WinPosSetWindowPos(Wnd, HWND_TOP,
|
|
|
|
wpl->ptMinPosition.x, wpl->ptMinPosition.y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_Flags);
|
|
|
|
Wnd->InternalPos.flags |= WPF_MININIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Wnd->style & WS_MAXIMIZE )
|
|
|
|
{
|
|
|
|
if (Flags & PLACE_MAX)
|
|
|
|
{
|
|
|
|
co_WinPosSetWindowPos(Wnd, HWND_TOP,
|
|
|
|
wpl->ptMaxPosition.x, wpl->ptMaxPosition.y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_Flags);
|
|
|
|
Wnd->InternalPos.flags |= WPF_MAXINIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Flags & PLACE_RECT)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
co_WinPosSetWindowPos(Wnd, HWND_TOP,
|
|
|
|
wpl->rcNormalPosition.left, wpl->rcNormalPosition.top,
|
|
|
|
wpl->rcNormalPosition.right - wpl->rcNormalPosition.left,
|
|
|
|
wpl->rcNormalPosition.bottom - wpl->rcNormalPosition.top,
|
|
|
|
SWP_Flags);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2011-12-10 07:41:56 +00:00
|
|
|
|
|
|
|
sAsync = (Wnd->head.pti->MessageQueue != gptiCurrent->MessageQueue && wpl->flags & WPF_ASYNCWINDOWPLACEMENT);
|
|
|
|
|
|
|
|
if ( sAsync )
|
|
|
|
co_IntSendMessageNoWait( UserHMGetHandle(Wnd), WM_ASYNC_SHOWWINDOW, wpl->showCmd, 0 );
|
|
|
|
else
|
|
|
|
co_WinPosShowWindow(Wnd, wpl->showCmd);
|
|
|
|
|
|
|
|
if ( Wnd->style & WS_MINIMIZE && !sAsync )
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
if ( wpl->flags & WPF_SETMINPOSITION )
|
|
|
|
Wnd->InternalPos.flags |= WPF_SETMINPOSITION;
|
|
|
|
|
|
|
|
if ( wpl->flags & WPF_RESTORETOMAXIMIZED )
|
|
|
|
Wnd->InternalPos.flags |= WPF_RESTORETOMAXIMIZED;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2011-12-10 07:41:56 +00:00
|
|
|
return TRUE;
|
2002-07-04 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 21:13:00 +00:00
|
|
|
UINT FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT* NewPos)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
POINT Size;
|
2011-12-10 07:41:56 +00:00
|
|
|
WINDOWPLACEMENT wpl;
|
2005-09-07 21:25:42 +00:00
|
|
|
UINT SwpFlags = 0;
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
ASSERT_REFS_CO(Wnd);
|
2005-09-07 20:59:26 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
wpl.length = sizeof(wpl);
|
|
|
|
IntGetWindowPlacement( Wnd, &wpl );
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (co_HOOK_CallHooks( WH_CBT, HCBT_MINMAX, (WPARAM)Wnd->head.h, ShowFlag))
|
2010-10-23 05:36:12 +00:00
|
|
|
{
|
2011-08-21 12:38:52 +00:00
|
|
|
ERR("WinPosMinMaximize WH_CBT Call Hook return!\n");
|
2009-06-28 03:02:15 +00:00
|
|
|
return SWP_NOSIZE | SWP_NOMOVE;
|
2010-10-23 05:36:12 +00:00
|
|
|
}
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->style & WS_MINIMIZE)
|
2008-07-16 01:22:26 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
if (ShowFlag == SW_MINIMIZE) return SWP_NOSIZE | SWP_NOMOVE;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (!co_IntSendMessageNoWait(Wnd->head.h, WM_QUERYOPEN, 0, 0))
|
2008-07-16 02:06:05 +00:00
|
|
|
{
|
|
|
|
return(SWP_NOSIZE | SWP_NOMOVE);
|
|
|
|
}
|
|
|
|
SwpFlags |= SWP_NOCOPYBITS;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
switch (ShowFlag)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
case SW_MINIMIZE:
|
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->style & WS_MAXIMIZE)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
Wnd->InternalPos.flags |= WPF_RESTORETOMAXIMIZED;
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style &= ~WS_MAXIMIZE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2010-10-11 03:41:41 +00:00
|
|
|
co_UserRedrawWindow(Wnd, NULL, 0, RDW_VALIDATE | RDW_NOERASE |
|
2005-09-07 21:25:42 +00:00
|
|
|
RDW_NOINTERNALPAINT);
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style |= WS_MINIMIZE;
|
2011-12-10 07:41:56 +00:00
|
|
|
WinPosFindIconPos(Wnd, &wpl.ptMinPosition);
|
|
|
|
RECTL_vSetRect(NewPos, wpl.ptMinPosition.x, wpl.ptMinPosition.y,
|
2005-09-07 21:25:42 +00:00
|
|
|
UserGetSystemMetrics(SM_CXMINIMIZED),
|
|
|
|
UserGetSystemMetrics(SM_CYMINIMIZED));
|
|
|
|
SwpFlags |= SWP_NOCOPYBITS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SW_MAXIMIZE:
|
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
co_WinPosGetMinMaxInfo(Wnd, &Size, &wpl.ptMaxPosition, NULL, NULL);
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Maximize: %d,%d %dx%d\n",
|
2011-12-10 07:41:56 +00:00
|
|
|
wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->style & WS_MINIMIZE)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style &= ~WS_MINIMIZE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style |= WS_MAXIMIZE;
|
2011-12-10 07:41:56 +00:00
|
|
|
RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
|
2005-09-07 21:25:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SW_RESTORE:
|
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->style & WS_MINIMIZE)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style &= ~WS_MINIMIZE;
|
2011-12-10 07:41:56 +00:00
|
|
|
if (Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
co_WinPosGetMinMaxInfo(Wnd, &Size, &wpl.ptMaxPosition, NULL, NULL);
|
|
|
|
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style |= WS_MAXIMIZE;
|
2011-12-10 07:41:56 +00:00
|
|
|
RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
|
2005-09-07 21:25:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
*NewPos = wpl.rcNormalPosition;
|
2005-09-07 21:25:42 +00:00
|
|
|
NewPos->right -= NewPos->left;
|
|
|
|
NewPos->bottom -= NewPos->top;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
if (!(Wnd->style & WS_MAXIMIZE))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-07-20 23:18:16 +00:00
|
|
|
Wnd->style &= ~WS_MAXIMIZE;
|
2011-12-10 07:41:56 +00:00
|
|
|
Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
|
|
|
|
*NewPos = wpl.rcNormalPosition;
|
2005-09-07 21:25:42 +00:00
|
|
|
NewPos->right -= NewPos->left;
|
|
|
|
NewPos->bottom -= NewPos->top;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(SwpFlags);
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
BOOL
|
|
|
|
UserHasWindowEdge(DWORD Style, DWORD ExStyle)
|
2002-07-04 19:56:38 +00:00
|
|
|
{
|
2010-05-18 09:01:08 +00:00
|
|
|
if (Style & WS_MINIMIZE)
|
|
|
|
return TRUE;
|
|
|
|
if (ExStyle & WS_EX_DLGMODALFRAME)
|
|
|
|
return TRUE;
|
|
|
|
if (ExStyle & WS_EX_STATICEDGE)
|
|
|
|
return FALSE;
|
|
|
|
if (Style & WS_THICKFRAME)
|
|
|
|
return TRUE;
|
|
|
|
Style &= WS_CAPTION;
|
|
|
|
if (Style == WS_DLGFRAME || Style == WS_CAPTION)
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
VOID
|
|
|
|
UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
|
|
|
|
{
|
|
|
|
DWORD Border = 0;
|
|
|
|
|
|
|
|
if (UserHasWindowEdge(Style, ExStyle))
|
|
|
|
Border += 2;
|
|
|
|
else if (ExStyle & WS_EX_STATICEDGE)
|
|
|
|
Border += 1;
|
|
|
|
if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient)
|
|
|
|
Border += 2;
|
|
|
|
if (Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME)
|
|
|
|
Border ++;
|
|
|
|
Size->cx = Size->cy = Border;
|
|
|
|
if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
|
|
|
|
{
|
|
|
|
Size->cx += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME);
|
|
|
|
Size->cy += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME);
|
|
|
|
}
|
|
|
|
Size->cx *= UserGetSystemMetrics(SM_CXBORDER);
|
|
|
|
Size->cy *= UserGetSystemMetrics(SM_CYBORDER);
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
BOOL WINAPI
|
|
|
|
UserAdjustWindowRectEx(LPRECT lpRect,
|
|
|
|
DWORD dwStyle,
|
|
|
|
BOOL bMenu,
|
|
|
|
DWORD dwExStyle)
|
|
|
|
{
|
|
|
|
SIZE BorderSize;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
if (bMenu)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-05-18 09:01:08 +00:00
|
|
|
lpRect->top -= UserGetSystemMetrics(SM_CYMENU);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2010-05-18 09:01:08 +00:00
|
|
|
if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-05-18 09:01:08 +00:00
|
|
|
if (dwExStyle & WS_EX_TOOLWINDOW)
|
|
|
|
lpRect->top -= UserGetSystemMetrics(SM_CYSMCAPTION);
|
|
|
|
else
|
|
|
|
lpRect->top -= UserGetSystemMetrics(SM_CYCAPTION);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2010-05-18 09:01:08 +00:00
|
|
|
UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE);
|
|
|
|
RECTL_vInflateRect(
|
|
|
|
lpRect,
|
|
|
|
BorderSize.cx,
|
|
|
|
BorderSize.cy);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-05-19 18:47:39 +00:00
|
|
|
UINT FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos,
|
2010-05-19 18:47:39 +00:00
|
|
|
POINT* MinTrack, POINT* MaxTrack)
|
2010-05-18 09:01:08 +00:00
|
|
|
{
|
2010-05-19 18:47:39 +00:00
|
|
|
MINMAXINFO MinMax;
|
|
|
|
PMONITOR monitor;
|
2010-05-18 09:01:08 +00:00
|
|
|
INT xinc, yinc;
|
2010-10-11 03:41:41 +00:00
|
|
|
LONG style = Window->style;
|
2010-05-18 09:01:08 +00:00
|
|
|
LONG adjustedStyle;
|
2010-10-11 03:41:41 +00:00
|
|
|
LONG exstyle = Window->ExStyle;
|
2010-05-18 09:01:08 +00:00
|
|
|
RECT rc;
|
|
|
|
|
2010-05-19 18:47:39 +00:00
|
|
|
ASSERT_REFS_CO(Window);
|
|
|
|
|
2010-05-18 09:01:08 +00:00
|
|
|
/* Compute default values */
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
rc = Window->rcWindow;
|
2010-05-19 18:47:39 +00:00
|
|
|
MinMax.ptReserved.x = rc.left;
|
|
|
|
MinMax.ptReserved.y = rc.top;
|
2010-05-18 09:01:08 +00:00
|
|
|
|
|
|
|
if ((style & WS_CAPTION) == WS_CAPTION)
|
|
|
|
adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
|
|
|
|
else
|
|
|
|
adjustedStyle = style;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window->spwndParent)
|
2010-05-18 09:01:08 +00:00
|
|
|
IntGetClientRect(Window->spwndParent, &rc);
|
2010-10-11 03:41:41 +00:00
|
|
|
UserAdjustWindowRectEx(&rc, adjustedStyle, ((style & WS_POPUP) && Window->IDMenu), exstyle);
|
2010-05-18 09:01:08 +00:00
|
|
|
|
|
|
|
xinc = -rc.left;
|
|
|
|
yinc = -rc.top;
|
|
|
|
|
2010-05-19 18:47:39 +00:00
|
|
|
MinMax.ptMaxSize.x = rc.right - rc.left;
|
|
|
|
MinMax.ptMaxSize.y = rc.bottom - rc.top;
|
2010-05-18 09:01:08 +00:00
|
|
|
if (style & (WS_DLGFRAME | WS_BORDER))
|
|
|
|
{
|
2010-05-19 18:47:39 +00:00
|
|
|
MinMax.ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK);
|
|
|
|
MinMax.ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK);
|
2010-05-18 09:01:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-19 18:47:39 +00:00
|
|
|
MinMax.ptMinTrackSize.x = 2 * xinc;
|
|
|
|
MinMax.ptMinTrackSize.y = 2 * yinc;
|
2010-05-18 09:01:08 +00:00
|
|
|
}
|
2010-05-19 18:47:39 +00:00
|
|
|
MinMax.ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK);
|
|
|
|
MinMax.ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK);
|
|
|
|
MinMax.ptMaxPosition.x = -xinc;
|
|
|
|
MinMax.ptMaxPosition.y = -yinc;
|
2010-05-18 09:01:08 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if (!EMPTYPOINT(Window->InternalPos.MaxPos)) MinMax.ptMaxPosition = Window->InternalPos.MaxPos;
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2011-12-10 06:08:29 +00:00
|
|
|
co_IntSendMessage(Window->head.h, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax);
|
2005-09-08 16:18:51 +00:00
|
|
|
|
2010-05-19 18:47:39 +00:00
|
|
|
/* if the app didn't change the values, adapt them for the current monitor */
|
|
|
|
if ((monitor = IntGetPrimaryMonitor()))
|
|
|
|
{
|
|
|
|
RECT rc_work;
|
|
|
|
|
|
|
|
rc_work = monitor->rcMonitor;
|
|
|
|
|
|
|
|
if (style & WS_MAXIMIZEBOX)
|
|
|
|
{
|
|
|
|
if ((style & WS_CAPTION) == WS_CAPTION || !(style & (WS_CHILD | WS_POPUP)))
|
|
|
|
rc_work = monitor->rcWork;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MinMax.ptMaxSize.x == UserGetSystemMetrics(SM_CXSCREEN) + 2 * xinc &&
|
|
|
|
MinMax.ptMaxSize.y == UserGetSystemMetrics(SM_CYSCREEN) + 2 * yinc)
|
|
|
|
{
|
|
|
|
MinMax.ptMaxSize.x = (rc_work.right - rc_work.left) + 2 * xinc;
|
|
|
|
MinMax.ptMaxSize.y = (rc_work.bottom - rc_work.top) + 2 * yinc;
|
|
|
|
}
|
|
|
|
if (MinMax.ptMaxPosition.x == -xinc && MinMax.ptMaxPosition.y == -yinc)
|
|
|
|
{
|
|
|
|
MinMax.ptMaxPosition.x = rc_work.left - xinc;
|
|
|
|
MinMax.ptMaxPosition.y = rc_work.top - yinc;
|
|
|
|
}
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,
|
|
|
|
MinMax.ptMinTrackSize.x);
|
|
|
|
MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y,
|
|
|
|
MinMax.ptMinTrackSize.y);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (MaxSize)
|
|
|
|
*MaxSize = MinMax.ptMaxSize;
|
|
|
|
if (MaxPos)
|
|
|
|
*MaxPos = MinMax.ptMaxPosition;
|
|
|
|
if (MinTrack)
|
|
|
|
*MinTrack = MinMax.ptMinTrackSize;
|
|
|
|
if (MaxTrack)
|
|
|
|
*MaxTrack = MinMax.ptMaxTrackSize;
|
2003-05-18 17:16:18 +00:00
|
|
|
|
2011-12-14 04:07:06 +00:00
|
|
|
return 0; // FIXME: What does it return?
|
2002-07-04 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
|
|
|
VOID FASTCALL
|
2009-03-19 01:42:34 +00:00
|
|
|
FixClientRect(PRECTL ClientRect, PRECTL WindowRect)
|
2004-03-23 21:30:18 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
if (ClientRect->left < WindowRect->left)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->left = WindowRect->left;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else if (WindowRect->right < ClientRect->left)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->left = WindowRect->right;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
if (ClientRect->right < WindowRect->left)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->right = WindowRect->left;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else if (WindowRect->right < ClientRect->right)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->right = WindowRect->right;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
if (ClientRect->top < WindowRect->top)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->top = WindowRect->top;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else if (WindowRect->bottom < ClientRect->top)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->top = WindowRect->bottom;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
if (ClientRect->bottom < WindowRect->top)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->bottom = WindowRect->top;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else if (WindowRect->bottom < ClientRect->bottom)
|
|
|
|
{
|
2004-03-23 21:30:18 +00:00
|
|
|
ClientRect->bottom = WindowRect->bottom;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2004-03-23 21:30:18 +00:00
|
|
|
}
|
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
|
|
|
LONG FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosDoNCCALCSize(PWND Window, PWINDOWPOS WinPos,
|
2005-09-07 21:25:42 +00:00
|
|
|
RECT* WindowRect, RECT* ClientRect)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Parent;
|
2005-09-07 21:25:42 +00:00
|
|
|
UINT wvrFlags = 0;
|
2003-09-09 09:39:21 +00:00
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
ASSERT_REFS_CO(Window);
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* Send WM_NCCALCSIZE message to get new client area */
|
|
|
|
if ((WinPos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE)
|
|
|
|
{
|
2003-09-09 09:39:21 +00:00
|
|
|
NCCALCSIZE_PARAMS params;
|
|
|
|
WINDOWPOS winposCopy;
|
|
|
|
|
|
|
|
params.rgrc[0] = *WindowRect;
|
2010-10-11 03:41:41 +00:00
|
|
|
params.rgrc[1] = Window->rcWindow;
|
|
|
|
params.rgrc[2] = Window->rcClient;
|
2009-12-14 05:02:56 +00:00
|
|
|
Parent = Window->spwndParent;
|
2010-10-11 03:41:41 +00:00
|
|
|
if (0 != (Window->style & WS_CHILD) && Parent)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
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);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2003-09-09 09:39:21 +00:00
|
|
|
params.lppos = &winposCopy;
|
|
|
|
winposCopy = *WinPos;
|
|
|
|
|
2011-10-18 10:48:03 +00:00
|
|
|
wvrFlags = co_IntSendMessage(Window->head.h, WM_NCCALCSIZE, TRUE, (LPARAM) ¶ms);
|
2003-09-09 09:39:21 +00:00
|
|
|
|
|
|
|
/* If the application send back garbage, ignore it */
|
|
|
|
if (params.rgrc[0].left <= params.rgrc[0].right &&
|
2007-11-15 22:08:13 +00:00
|
|
|
params.rgrc[0].top <= params.rgrc[0].bottom)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
*ClientRect = params.rgrc[0];
|
2010-10-11 03:41:41 +00:00
|
|
|
if ((Window->style & WS_CHILD) && Parent)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
RECTL_vOffsetRect(ClientRect, Parent->rcClient.left,
|
|
|
|
Parent->rcClient.top);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
FixClientRect(ClientRect, WindowRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: WVR_ALIGNxxx */
|
2003-09-09 09:39:21 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (ClientRect->left != Window->rcClient.left ||
|
|
|
|
ClientRect->top != Window->rcClient.top)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_NOCLIENTMOVE;
|
|
|
|
}
|
2003-09-09 09:39:21 +00:00
|
|
|
|
|
|
|
if ((ClientRect->right - ClientRect->left !=
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcClient.right - Window->rcClient.left) ||
|
2005-09-07 21:25:42 +00:00
|
|
|
(ClientRect->bottom - ClientRect->top !=
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcClient.bottom - Window->rcClient.top))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_NOCLIENTSIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-09 09:39:21 +00:00
|
|
|
if (! (WinPos->flags & SWP_NOMOVE)
|
2010-10-11 03:41:41 +00:00
|
|
|
&& (ClientRect->left != Window->rcClient.left ||
|
|
|
|
ClientRect->top != Window->rcClient.top))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_NOCLIENTMOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return wvrFlags;
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
2003-12-23 21:13:00 +00:00
|
|
|
BOOL FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosDoWinPosChanging(PWND Window,
|
2005-09-07 21:25:42 +00:00
|
|
|
PWINDOWPOS WinPos,
|
2009-03-19 01:42:34 +00:00
|
|
|
PRECTL WindowRect,
|
|
|
|
PRECTL ClientRect)
|
2002-07-04 19:56:38 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
INT X, Y;
|
2003-09-21 06:44:51 +00:00
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
ASSERT_REFS_CO(Window);
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (!(WinPos->flags & SWP_NOSENDCHANGING))
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
co_IntSendMessageNoWait(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
*WindowRect = Window->rcWindow;
|
|
|
|
*ClientRect = Window->rcClient;
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (!(WinPos->flags & SWP_NOSIZE))
|
|
|
|
{
|
2002-07-04 19:56:38 +00:00
|
|
|
WindowRect->right = WindowRect->left + WinPos->cx;
|
|
|
|
WindowRect->bottom = WindowRect->top + WinPos->cy;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (!(WinPos->flags & SWP_NOMOVE))
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Parent;
|
2003-09-21 06:44:51 +00:00
|
|
|
X = WinPos->x;
|
|
|
|
Y = WinPos->y;
|
2009-12-14 05:02:56 +00:00
|
|
|
Parent = Window->spwndParent;
|
2010-10-11 03:41:41 +00:00
|
|
|
if ((0 != (Window->style & WS_CHILD)) && Parent)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
X += Parent->rcClient.left;
|
|
|
|
Y += Parent->rcClient.top;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2005-09-06 14:09:22 +00:00
|
|
|
|
2003-09-21 06:44:51 +00:00
|
|
|
WindowRect->left = X;
|
|
|
|
WindowRect->top = Y;
|
2010-10-11 03:41:41 +00:00
|
|
|
WindowRect->right += X - Window->rcWindow.left;
|
|
|
|
WindowRect->bottom += Y - Window->rcWindow.top;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL_vOffsetRect(ClientRect,
|
2010-10-11 03:41:41 +00:00
|
|
|
X - Window->rcWindow.left,
|
|
|
|
Y - Window->rcWindow.top);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
|
2003-08-29 09:29:11 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
2002-07-04 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-29 10:04:55 +00:00
|
|
|
/*
|
|
|
|
* Fix Z order taking into account owned popups -
|
|
|
|
* basically we need to maintain them above the window that owns them
|
|
|
|
*/
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
2003-10-29 10:04:55 +00:00
|
|
|
HWND FASTCALL
|
2011-09-18 12:33:38 +00:00
|
|
|
WinPosDoOwnedPopups(PWND Window, HWND hWndInsertAfter)
|
2003-10-29 10:04:55 +00:00
|
|
|
{
|
2003-12-22 11:37:32 +00:00
|
|
|
HWND *List = NULL;
|
2010-06-03 16:12:43 +00:00
|
|
|
HWND Owner;
|
|
|
|
LONG Style;
|
2011-09-18 12:33:38 +00:00
|
|
|
PWND DesktopWindow, ChildObject;
|
2003-12-22 11:37:32 +00:00
|
|
|
int i;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Owner = Window->spwndOwner ? Window->spwndOwner->head.h : NULL;
|
|
|
|
Style = Window->style;
|
2010-06-03 16:12:43 +00:00
|
|
|
|
2003-12-22 11:37:32 +00:00
|
|
|
if ((Style & WS_POPUP) && Owner)
|
|
|
|
{
|
|
|
|
/* Make sure this popup stays above the owner */
|
2004-04-01 23:16:21 +00:00
|
|
|
HWND hWndLocalPrev = HWND_TOPMOST;
|
2003-12-22 11:37:32 +00:00
|
|
|
|
2004-04-01 23:16:21 +00:00
|
|
|
if (hWndInsertAfter != HWND_TOPMOST)
|
2003-12-22 11:37:32 +00:00
|
|
|
{
|
2005-09-11 14:48:32 +00:00
|
|
|
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
|
2003-12-22 11:37:32 +00:00
|
|
|
List = IntWinListChildren(DesktopWindow);
|
2005-09-11 14:48:32 +00:00
|
|
|
|
2003-12-22 11:37:32 +00:00
|
|
|
if (List != NULL)
|
|
|
|
{
|
|
|
|
for (i = 0; List[i]; i++)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
if (List[i] == Owner)
|
|
|
|
break;
|
2004-04-01 23:16:21 +00:00
|
|
|
if (HWND_TOP == hWndInsertAfter)
|
|
|
|
{
|
2005-09-11 14:48:32 +00:00
|
|
|
ChildObject = UserGetWindowObject(List[i]);
|
2005-09-07 21:25:42 +00:00
|
|
|
if (NULL != ChildObject)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
if (0 == (ChildObject->ExStyle & WS_EX_TOPMOST))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-04-01 23:16:21 +00:00
|
|
|
}
|
2011-09-18 12:33:38 +00:00
|
|
|
if (List[i] != Window->head.h)
|
2005-09-07 21:25:42 +00:00
|
|
|
hWndLocalPrev = List[i];
|
|
|
|
if (hWndLocalPrev == hWndInsertAfter)
|
|
|
|
break;
|
2003-12-22 11:37:32 +00:00
|
|
|
}
|
|
|
|
hWndInsertAfter = hWndLocalPrev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Style & WS_CHILD)
|
|
|
|
{
|
|
|
|
return hWndInsertAfter;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!List)
|
|
|
|
{
|
2005-09-11 14:48:32 +00:00
|
|
|
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
|
2003-12-22 11:37:32 +00:00
|
|
|
List = IntWinListChildren(DesktopWindow);
|
|
|
|
}
|
|
|
|
if (List != NULL)
|
|
|
|
{
|
|
|
|
for (i = 0; List[i]; i++)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Wnd;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-09-18 12:33:38 +00:00
|
|
|
if (List[i] == Window->head.h)
|
2003-12-22 11:37:32 +00:00
|
|
|
break;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
if (!(Wnd = UserGetWindowObject(List[i])))
|
|
|
|
continue;
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (Wnd->style & WS_POPUP && Wnd->spwndOwner == Window)
|
2003-12-22 11:37:32 +00:00
|
|
|
{
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
UserRefObjectCo(Wnd, &Ref);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2005-09-07 20:59:26 +00:00
|
|
|
co_WinPosSetWindowPos(Wnd, hWndInsertAfter, 0, 0, 0, 0,
|
2005-09-07 21:25:42 +00:00
|
|
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
|
|
|
|
2005-09-07 20:59:26 +00:00
|
|
|
UserDerefObjectCo(Wnd);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2003-12-22 11:37:32 +00:00
|
|
|
hWndInsertAfter = List[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExFreePool(List);
|
|
|
|
}
|
|
|
|
|
2003-10-29 10:04:55 +00:00
|
|
|
return hWndInsertAfter;
|
|
|
|
}
|
|
|
|
|
2003-08-24 16:20:30 +00:00
|
|
|
/***********************************************************************
|
2005-09-07 21:25:42 +00:00
|
|
|
* WinPosInternalMoveWindow
|
2003-08-24 16:20:30 +00:00
|
|
|
*
|
|
|
|
* Update WindowRect and ClientRect of Window and all of its children
|
|
|
|
* We keep both WindowRect and ClientRect in screen coordinates internally
|
|
|
|
*/
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
|
|
|
VOID FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
WinPosInternalMoveWindow(PWND Window, INT MoveX, INT MoveY)
|
2003-08-24 16:20:30 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Child;
|
2003-08-24 16:20:30 +00:00
|
|
|
|
2009-12-14 05:02:56 +00:00
|
|
|
ASSERT(Window != Window->spwndChild);
|
2009-07-09 14:56:59 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcWindow.left += MoveX;
|
|
|
|
Window->rcWindow.right += MoveX;
|
|
|
|
Window->rcWindow.top += MoveY;
|
|
|
|
Window->rcWindow.bottom += MoveY;
|
2003-08-24 16:20:30 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcClient.left += MoveX;
|
|
|
|
Window->rcClient.right += MoveX;
|
|
|
|
Window->rcClient.top += MoveY;
|
|
|
|
Window->rcClient.bottom += MoveY;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-12-14 05:02:56 +00:00
|
|
|
for(Child = Window->spwndChild; Child; Child = Child->spwndNext)
|
2004-02-22 14:26:35 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
WinPosInternalMoveWindow(Child, MoveX, MoveY);
|
2004-02-22 14:26:35 +00:00
|
|
|
}
|
2003-08-24 16:20:30 +00:00
|
|
|
}
|
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
/*
|
|
|
|
* WinPosFixupSWPFlags
|
|
|
|
*
|
|
|
|
* Fix redundant flags and values in the WINDOWPOS structure.
|
|
|
|
*/
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
2003-11-20 09:18:49 +00:00
|
|
|
BOOL FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
WinPosFixupFlags(WINDOWPOS *WinPos, PWND Wnd)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->style & WS_VISIBLE)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_SHOWWINDOW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_HIDEWINDOW;
|
|
|
|
if (!(WinPos->flags & SWP_SHOWWINDOW))
|
|
|
|
WinPos->flags |= SWP_NOREDRAW;
|
|
|
|
}
|
|
|
|
|
|
|
|
WinPos->cx = max(WinPos->cx, 0);
|
|
|
|
WinPos->cy = max(WinPos->cy, 0);
|
|
|
|
|
|
|
|
/* Check for right size */
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->rcWindow.right - Wnd->rcWindow.left == WinPos->cx &&
|
|
|
|
Wnd->rcWindow.bottom - Wnd->rcWindow.top == WinPos->cy)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2005-05-08 02:11:54 +00:00
|
|
|
WinPos->flags |= SWP_NOSIZE;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for right position */
|
2009-07-20 23:18:16 +00:00
|
|
|
if (Wnd->rcWindow.left == WinPos->x &&
|
|
|
|
Wnd->rcWindow.top == WinPos->y)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2005-05-08 02:11:54 +00:00
|
|
|
WinPos->flags |= SWP_NOMOVE;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
if (WinPos->hwnd == UserGetForegroundWindow())
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WinPos->flags |= SWP_NOACTIVATE; /* Already active */
|
|
|
|
}
|
|
|
|
else
|
2009-07-20 23:18:16 +00:00
|
|
|
if ((Wnd->style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
/* Bring to the top when activating */
|
|
|
|
if (!(WinPos->flags & SWP_NOACTIVATE))
|
|
|
|
{
|
|
|
|
WinPos->flags &= ~SWP_NOZORDER;
|
2007-11-15 22:08:13 +00:00
|
|
|
WinPos->hwndInsertAfter = (0 != (Wnd->ExStyle & WS_EX_TOPMOST) ?
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND_TOPMOST : HWND_TOP);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check hwndInsertAfter */
|
|
|
|
if (!(WinPos->flags & SWP_NOZORDER))
|
|
|
|
{
|
|
|
|
/* Fix sign extension */
|
|
|
|
if (WinPos->hwndInsertAfter == (HWND)0xffff)
|
|
|
|
{
|
|
|
|
WinPos->hwndInsertAfter = HWND_TOPMOST;
|
|
|
|
}
|
|
|
|
else if (WinPos->hwndInsertAfter == (HWND)0xfffe)
|
|
|
|
{
|
|
|
|
WinPos->hwndInsertAfter = HWND_NOTOPMOST;
|
|
|
|
}
|
|
|
|
|
2004-03-30 20:50:16 +00:00
|
|
|
if (WinPos->hwndInsertAfter == HWND_NOTOPMOST)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WinPos->hwndInsertAfter = HWND_TOP;
|
|
|
|
}
|
2004-03-30 20:50:16 +00:00
|
|
|
else if (HWND_TOP == WinPos->hwndInsertAfter
|
2007-11-15 22:08:13 +00:00
|
|
|
&& 0 != (Wnd->ExStyle & WS_EX_TOPMOST))
|
2004-03-30 20:50:16 +00:00
|
|
|
{
|
|
|
|
/* Keep it topmost when it's already topmost */
|
|
|
|
WinPos->hwndInsertAfter = HWND_TOPMOST;
|
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
|
|
|
|
/* hwndInsertAfter must be a sibling of the window */
|
2004-03-30 20:50:16 +00:00
|
|
|
if (HWND_TOPMOST != WinPos->hwndInsertAfter
|
2005-09-07 21:25:42 +00:00
|
|
|
&& HWND_TOP != WinPos->hwndInsertAfter
|
|
|
|
&& HWND_NOTOPMOST != WinPos->hwndInsertAfter
|
|
|
|
&& HWND_BOTTOM != WinPos->hwndInsertAfter)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-09-18 12:33:38 +00:00
|
|
|
PWND InsAfterWnd;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
InsAfterWnd = UserGetWindowObject(WinPos->hwndInsertAfter);
|
2011-09-18 12:33:38 +00:00
|
|
|
if(!InsAfterWnd)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-09-18 12:33:38 +00:00
|
|
|
if (InsAfterWnd->spwndParent != Wnd->spwndParent)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We don't need to change the Z order of hwnd if it's already
|
|
|
|
* inserted after hwndInsertAfter or when inserting hwnd after
|
|
|
|
* itself.
|
|
|
|
*/
|
|
|
|
if ((WinPos->hwnd == WinPos->hwndInsertAfter) ||
|
2010-10-11 03:41:41 +00:00
|
|
|
((InsAfterWnd->spwndNext) && (WinPos->hwnd == InsAfterWnd->spwndNext->head.h)))
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WinPos->flags |= SWP_NOZORDER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-08-01 14:38:51 +00:00
|
|
|
|
2003-09-21 06:44:51 +00:00
|
|
|
/* x and y are always screen relative */
|
2003-12-23 21:13:00 +00:00
|
|
|
BOOLEAN FASTCALL
|
2005-09-07 20:59:26 +00:00
|
|
|
co_WinPosSetWindowPos(
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window,
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND WndInsertAfter,
|
|
|
|
INT x,
|
|
|
|
INT y,
|
2005-09-07 20:59:26 +00:00
|
|
|
INT cx,
|
2005-09-07 21:25:42 +00:00
|
|
|
INT cy,
|
2005-09-07 20:59:26 +00:00
|
|
|
UINT flags
|
2005-09-07 21:25:42 +00:00
|
|
|
)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2003-11-20 09:18:49 +00:00
|
|
|
WINDOWPOS WinPos;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL NewWindowRect;
|
|
|
|
RECTL NewClientRect;
|
2004-03-22 20:14:29 +00:00
|
|
|
PROSRGNDATA VisRgn;
|
2003-11-20 09:18:49 +00:00
|
|
|
HRGN VisBefore = NULL;
|
|
|
|
HRGN VisAfter = NULL;
|
|
|
|
HRGN DirtyRgn = NULL;
|
|
|
|
HRGN ExposedRgn = NULL;
|
|
|
|
HRGN CopyRgn = NULL;
|
|
|
|
ULONG WvrFlags = 0;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL OldWindowRect, OldClientRect;
|
2003-11-20 09:18:49 +00:00
|
|
|
int RgnType;
|
|
|
|
HDC Dc;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL CopyRect;
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Ancestor;
|
2011-09-03 17:53:14 +00:00
|
|
|
BOOL bPointerInWindow;
|
2003-11-20 09:18:49 +00:00
|
|
|
|
2005-09-07 20:59:26 +00:00
|
|
|
ASSERT_REFS_CO(Window);
|
2003-11-20 09:18:49 +00:00
|
|
|
|
2005-09-07 20:59:26 +00:00
|
|
|
/* FIXME: Get current active window from active queue. */
|
2003-12-07 23:02:57 +00:00
|
|
|
/*
|
|
|
|
* Only allow CSRSS to mess with the desktop window
|
|
|
|
*/
|
2010-06-27 12:36:23 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if ( Window->head.h == IntGetDesktopWindow() &&
|
|
|
|
Window->head.pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
ERR("Desktop Window...\n");
|
2004-02-21 13:13:27 +00:00
|
|
|
return FALSE;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2011-09-03 17:53:14 +00:00
|
|
|
bPointerInWindow = IntPtInWindow(Window, gpsi->ptCursor.x, gpsi->ptCursor.y);
|
2003-11-20 21:21:29 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
WinPos.hwnd = Window->head.h;
|
2003-11-20 09:18:49 +00:00
|
|
|
WinPos.hwndInsertAfter = WndInsertAfter;
|
|
|
|
WinPos.x = x;
|
|
|
|
WinPos.y = y;
|
|
|
|
WinPos.cx = cx;
|
|
|
|
WinPos.cy = cy;
|
|
|
|
WinPos.flags = flags;
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
co_WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect);
|
2003-11-24 21:01:20 +00:00
|
|
|
|
2011-06-07 20:09:04 +00:00
|
|
|
/* Does the window still exist? */
|
|
|
|
if (!IntIsWindow(WinPos.hwnd))
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-06-07 20:09:04 +00:00
|
|
|
EngSetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
2003-11-20 09:18:49 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2011-06-07 20:09:04 +00:00
|
|
|
/* Fix up the flags. */
|
|
|
|
if (!WinPosFixupFlags(&WinPos, Window))
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-06-07 20:09:04 +00:00
|
|
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
2003-11-20 09:18:49 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-18 12:11:32 +00:00
|
|
|
Ancestor = UserGetAncestor(Window, GA_PARENT);
|
2010-01-28 23:34:57 +00:00
|
|
|
if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
|
2005-09-07 21:25:42 +00:00
|
|
|
SWP_NOZORDER &&
|
2010-10-11 03:41:41 +00:00
|
|
|
Ancestor && Ancestor->head.h == IntGetDesktopWindow() )
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-09-18 12:33:38 +00:00
|
|
|
WinPos.hwndInsertAfter = WinPosDoOwnedPopups(Window, WinPos.hwndInsertAfter);
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
if (!(WinPos.flags & SWP_NOREDRAW))
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2004-09-24 15:07:38 +00:00
|
|
|
/* Compute the visible region before the window position is changed */
|
2011-06-18 12:41:29 +00:00
|
|
|
if (!(WinPos.flags & SWP_SHOWWINDOW) &&
|
2010-01-28 23:34:57 +00:00
|
|
|
(WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
2005-09-07 21:25:42 +00:00
|
|
|
SWP_HIDEWINDOW | SWP_FRAMECHANGED)) !=
|
|
|
|
(SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER))
|
2004-03-22 20:14:29 +00:00
|
|
|
{
|
2011-06-18 14:55:03 +00:00
|
|
|
VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE,
|
2011-06-18 12:41:29 +00:00
|
|
|
(Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
|
2004-09-24 15:07:38 +00:00
|
|
|
VisRgn = NULL;
|
|
|
|
|
2010-01-28 23:34:57 +00:00
|
|
|
if ( VisBefore != NULL &&
|
|
|
|
(VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) &&
|
2011-06-18 12:41:29 +00:00
|
|
|
REGION_Complexity(VisRgn) == NULLREGION )
|
2004-09-24 15:07:38 +00:00
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2009-03-25 20:24:34 +00:00
|
|
|
GreDeleteObject(VisBefore);
|
2004-09-24 15:07:38 +00:00
|
|
|
VisBefore = NULL;
|
|
|
|
}
|
|
|
|
else if(VisRgn)
|
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2010-10-11 03:41:41 +00:00
|
|
|
NtGdiOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2004-03-22 20:14:29 +00:00
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
WvrFlags = co_WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect, &NewClientRect);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-09-03 16:22:32 +00:00
|
|
|
TRACE("co_WinPosDoNCCALCSize returned %d\n", WvrFlags);
|
2003-11-20 09:18:49 +00:00
|
|
|
|
|
|
|
/* Relink windows. (also take into account shell window in hwndShellWindow) */
|
2005-09-05 21:19:23 +00:00
|
|
|
if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2010-10-04 21:44:58 +00:00
|
|
|
IntLinkHwnd(Window, WndInsertAfter);
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
OldWindowRect = Window->rcWindow;
|
|
|
|
OldClientRect = Window->rcClient;
|
2003-08-01 14:38:51 +00:00
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
if (OldClientRect.bottom - OldClientRect.top ==
|
2005-09-07 21:25:42 +00:00
|
|
|
NewClientRect.bottom - NewClientRect.top)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WvrFlags &= ~WVR_VREDRAW;
|
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
if (OldClientRect.right - OldClientRect.left ==
|
2005-09-07 21:25:42 +00:00
|
|
|
NewClientRect.right - NewClientRect.left)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
WvrFlags &= ~WVR_HREDRAW;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Actually do something with WVR_VALIDRECTS */
|
|
|
|
|
2011-06-18 12:41:29 +00:00
|
|
|
if (NewClientRect.left != OldClientRect.left ||
|
|
|
|
NewClientRect.top != OldClientRect.top)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2003-08-24 16:20:30 +00:00
|
|
|
WinPosInternalMoveWindow(Window,
|
2004-02-08 10:53:17 +00:00
|
|
|
NewClientRect.left - OldClientRect.left,
|
|
|
|
NewClientRect.top - OldClientRect.top);
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2003-09-09 09:39:21 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcWindow = NewWindowRect;
|
|
|
|
Window->rcClient = NewClientRect;
|
2003-09-09 09:39:21 +00:00
|
|
|
|
2011-06-18 12:41:29 +00:00
|
|
|
if (WinPos.flags & SWP_HIDEWINDOW)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
|
|
|
/* Clear the update region */
|
2010-01-28 23:34:57 +00:00
|
|
|
co_UserRedrawWindow( Window,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
|
|
|
|
|
2011-06-18 12:41:29 +00:00
|
|
|
if (Window->spwndParent == UserGetDesktopWindow())
|
2010-10-11 03:41:41 +00:00
|
|
|
co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->head.h);
|
2011-06-18 12:41:29 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->style &= ~WS_VISIBLE;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2003-11-21 17:01:16 +00:00
|
|
|
else if (WinPos.flags & SWP_SHOWWINDOW)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2011-06-07 20:09:04 +00:00
|
|
|
if (Window->spwndParent == UserGetDesktopWindow())
|
2010-10-11 03:41:41 +00:00
|
|
|
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->head.h);
|
2011-06-07 20:09:04 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->style |= WS_VISIBLE;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2003-09-09 09:39:21 +00:00
|
|
|
|
2011-02-28 06:31:44 +00:00
|
|
|
if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != HRGN_WINDOW)
|
2005-09-19 10:39:26 +00:00
|
|
|
{
|
2010-01-10 07:50:57 +00:00
|
|
|
NtGdiOffsetRgn(Window->hrgnUpdate,
|
2005-09-19 10:39:26 +00:00
|
|
|
NewWindowRect.left - OldWindowRect.left,
|
|
|
|
NewWindowRect.top - OldWindowRect.top);
|
|
|
|
}
|
|
|
|
|
2004-12-26 20:34:49 +00:00
|
|
|
DceResetActiveDCEs(Window);
|
2004-02-04 22:59:04 +00:00
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
if (!(WinPos.flags & SWP_NOREDRAW))
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2004-09-24 15:07:38 +00:00
|
|
|
/* Determine the new visible region */
|
2011-06-18 14:55:03 +00:00
|
|
|
VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE,
|
2011-06-18 12:41:29 +00:00
|
|
|
(Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
|
2004-09-24 15:07:38 +00:00
|
|
|
VisRgn = NULL;
|
2003-11-20 09:18:49 +00:00
|
|
|
|
2010-01-28 23:34:57 +00:00
|
|
|
if ( VisAfter != NULL &&
|
|
|
|
(VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) &&
|
2011-06-18 12:41:29 +00:00
|
|
|
REGION_Complexity(VisRgn) == NULLREGION )
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2009-03-25 20:24:34 +00:00
|
|
|
GreDeleteObject(VisAfter);
|
2004-09-24 15:07:38 +00:00
|
|
|
VisAfter = NULL;
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
else if(VisRgn)
|
2003-12-27 15:09:51 +00:00
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2010-10-11 03:41:41 +00:00
|
|
|
NtGdiOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
|
2003-12-27 15:09:51 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
/*
|
2004-09-24 15:07:38 +00:00
|
|
|
* Determine which pixels can be copied from the old window position
|
|
|
|
* to the new. Those pixels must be visible in both the old and new
|
|
|
|
* position. Also, check the class style to see if the windows of this
|
|
|
|
* class need to be completely repainted on (horizontal/vertical) size
|
|
|
|
* change.
|
2003-11-20 09:18:49 +00:00
|
|
|
*/
|
2010-01-28 23:34:57 +00:00
|
|
|
if ( VisBefore != NULL &&
|
|
|
|
VisAfter != NULL &&
|
|
|
|
!(WinPos.flags & SWP_NOCOPYBITS) &&
|
2005-09-21 13:49:09 +00:00
|
|
|
((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) &&
|
2010-10-11 03:41:41 +00:00
|
|
|
!(Window->ExStyle & WS_EX_TRANSPARENT) )
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
CopyRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2004-09-24 15:07:38 +00:00
|
|
|
RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this is (also) a window resize, the whole nonclient area
|
|
|
|
* needs to be repainted. So we limit the copy to the client area,
|
|
|
|
* 'cause there is no use in copying it (would possibly cause
|
|
|
|
* "flashing" too). However, if the copy region is already empty,
|
|
|
|
* we don't have to crop (can't take anything away from an empty
|
|
|
|
* region...)
|
|
|
|
*/
|
2010-01-28 23:34:57 +00:00
|
|
|
if (!(WinPos.flags & SWP_NOSIZE) &&
|
|
|
|
RgnType != ERROR &&
|
|
|
|
RgnType != NULLREGION )
|
2004-03-22 20:14:29 +00:00
|
|
|
{
|
2008-03-17 22:17:48 +00:00
|
|
|
PROSRGNDATA pCopyRgn;
|
2009-03-19 01:42:34 +00:00
|
|
|
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);
|
2009-12-29 21:07:04 +00:00
|
|
|
pCopyRgn = RGNOBJAPI_Lock(CopyRgn, NULL);
|
2008-03-17 22:17:48 +00:00
|
|
|
REGION_CropAndOffsetRegion(pCopyRgn, pCopyRgn, &CopyRect, NULL);
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(pCopyRgn);
|
2004-03-22 20:14:29 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
|
|
|
|
/* No use in copying bits which are in the update region. */
|
2010-01-10 07:50:57 +00:00
|
|
|
if (Window->hrgnUpdate != NULL)
|
2004-09-24 15:07:38 +00:00
|
|
|
{
|
2005-09-19 10:39:26 +00:00
|
|
|
NtGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
|
2010-01-10 07:50:57 +00:00
|
|
|
NtGdiCombineRgn(CopyRgn, CopyRgn, Window->hrgnUpdate, RGN_DIFF);
|
2005-09-19 10:39:26 +00:00
|
|
|
NtGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
/*
|
2004-09-24 15:07:38 +00:00
|
|
|
* Now, get the bounding box of the copy region. If it's empty
|
|
|
|
* there's nothing to copy. Also, it's no use copying bits onto
|
|
|
|
* themselves.
|
2003-11-20 09:18:49 +00:00
|
|
|
*/
|
2010-01-28 23:34:57 +00:00
|
|
|
if ( (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(CopyRgn, NULL)) &&
|
2008-03-17 22:17:48 +00:00
|
|
|
REGION_GetRgnBox(VisRgn, &CopyRect) == NULLREGION)
|
2004-09-24 15:07:38 +00:00
|
|
|
{
|
|
|
|
/* Nothing to copy, clean up */
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GreDeleteObject(CopyRgn);
|
2004-09-24 15:07:38 +00:00
|
|
|
CopyRgn = NULL;
|
|
|
|
}
|
|
|
|
else if (OldWindowRect.left != NewWindowRect.left ||
|
|
|
|
OldWindowRect.top != NewWindowRect.top)
|
|
|
|
{
|
|
|
|
if(VisRgn)
|
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2005-09-19 10:39:26 +00:00
|
|
|
|
2010-01-28 23:34:57 +00:00
|
|
|
/*
|
|
|
|
* Small trick here: there is no function to bitblt a region. So
|
|
|
|
* we set the region as the clipping region, take the bounding box
|
|
|
|
* of the region and bitblt that. Since nothing outside the clipping
|
|
|
|
* region is copied, this has the effect of bitblt'ing the region.
|
|
|
|
*
|
|
|
|
* Since NtUserGetDCEx takes ownership of the clip region, we need
|
|
|
|
* to create a copy of CopyRgn and pass that. We need CopyRgn later
|
|
|
|
*/
|
2005-09-19 10:39:26 +00:00
|
|
|
NtGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
|
2010-01-28 23:34:57 +00:00
|
|
|
Dc = UserGetDCEx( Window,
|
|
|
|
CopyRgn,
|
|
|
|
DCX_WINDOW|DCX_CACHE|DCX_INTERSECTRGN|DCX_CLIPSIBLINGS|DCX_KEEPCLIPRGN);
|
|
|
|
NtGdiBitBlt( Dc,
|
|
|
|
CopyRect.left, CopyRect.top,
|
|
|
|
CopyRect.right - CopyRect.left,
|
|
|
|
CopyRect.bottom - CopyRect.top,
|
|
|
|
Dc,
|
|
|
|
CopyRect.left + (OldWindowRect.left - NewWindowRect.left),
|
|
|
|
CopyRect.top + (OldWindowRect.top - NewWindowRect.top),
|
|
|
|
SRCCOPY,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
|
2005-09-19 12:21:52 +00:00
|
|
|
UserReleaseDC(Window, Dc, FALSE);
|
2007-07-20 22:59:21 +00:00
|
|
|
IntValidateParent(Window, CopyRgn, FALSE);
|
2005-09-19 10:39:26 +00:00
|
|
|
NtGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
|
|
|
else if(VisRgn)
|
|
|
|
{
|
2009-12-29 21:07:04 +00:00
|
|
|
RGNOBJAPI_Unlock(VisRgn);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
else
|
2004-03-22 20:14:29 +00:00
|
|
|
{
|
2004-09-24 15:07:38 +00:00
|
|
|
CopyRgn = NULL;
|
2004-03-22 20:14:29 +00:00
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
/* We need to redraw what wasn't visible before */
|
|
|
|
if (VisAfter != NULL)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
DirtyRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2004-09-24 15:07:38 +00:00
|
|
|
if (CopyRgn != NULL)
|
|
|
|
{
|
|
|
|
RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, 0, RGN_COPY);
|
|
|
|
}
|
|
|
|
if (RgnType != ERROR && RgnType != NULLREGION)
|
|
|
|
{
|
2010-01-28 23:34:57 +00:00
|
|
|
/* old code
|
2009-07-20 23:18:16 +00:00
|
|
|
NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
|
2010-01-28 23:34:57 +00:00
|
|
|
IntInvalidateWindows( Window,
|
|
|
|
DirtyRgn,
|
2007-07-19 12:43:54 +00:00
|
|
|
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
|
|
|
}
|
2009-03-25 20:24:34 +00:00
|
|
|
GreDeleteObject(DirtyRgn);
|
2007-07-19 12:43:54 +00:00
|
|
|
*/
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Parent = Window->spwndParent;
|
2007-07-05 09:46:57 +00:00
|
|
|
|
2010-01-28 23:34:57 +00:00
|
|
|
NtGdiOffsetRgn( DirtyRgn,
|
2010-10-11 03:41:41 +00:00
|
|
|
Window->rcWindow.left,
|
|
|
|
Window->rcWindow.top);
|
|
|
|
if ( (Window->style & WS_CHILD) &&
|
2010-01-28 23:34:57 +00:00
|
|
|
(Parent) &&
|
2010-10-11 03:41:41 +00:00
|
|
|
!(Parent->style & WS_CLIPCHILDREN))
|
2007-07-04 22:22:30 +00:00
|
|
|
{
|
2010-01-28 23:34:57 +00:00
|
|
|
IntInvalidateWindows( Parent,
|
|
|
|
DirtyRgn,
|
|
|
|
RDW_ERASE | RDW_INVALIDATE);
|
2007-07-19 12:43:54 +00:00
|
|
|
co_IntPaintWindows(Parent, RDW_ERASENOW, FALSE);
|
2007-07-04 22:22:30 +00:00
|
|
|
}
|
2007-07-05 09:46:57 +00:00
|
|
|
else
|
|
|
|
{
|
2010-01-28 23:34:57 +00:00
|
|
|
IntInvalidateWindows( Window,
|
|
|
|
DirtyRgn,
|
|
|
|
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
2007-07-05 09:46:57 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GreDeleteObject(DirtyRgn);
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
|
|
|
|
if (CopyRgn != NULL)
|
2003-11-20 09:18:49 +00:00
|
|
|
{
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GreDeleteObject(CopyRgn);
|
2004-01-17 15:18:25 +00:00
|
|
|
}
|
2004-09-24 15:07:38 +00:00
|
|
|
|
|
|
|
/* Expose what was covered before but not covered anymore */
|
|
|
|
if (VisBefore != NULL)
|
2004-01-17 15:18:25 +00:00
|
|
|
{
|
2010-01-21 13:18:33 +00:00
|
|
|
ExposedRgn = IntSysCreateRectRgn(0, 0, 0, 0);
|
2011-06-18 12:41:29 +00:00
|
|
|
RgnType = NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY);
|
2010-01-28 23:34:57 +00:00
|
|
|
NtGdiOffsetRgn( ExposedRgn,
|
|
|
|
OldWindowRect.left - NewWindowRect.left,
|
|
|
|
OldWindowRect.top - NewWindowRect.top);
|
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
if (VisAfter != NULL)
|
|
|
|
RgnType = NtGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
|
2003-11-20 09:18:49 +00:00
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
if (RgnType != ERROR && RgnType != NULLREGION)
|
|
|
|
{
|
2005-09-05 21:19:23 +00:00
|
|
|
co_VIS_WindowLayoutChanged(Window, ExposedRgn);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GreDeleteObject(ExposedRgn);
|
|
|
|
GreDeleteObject(VisBefore);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2003-11-20 09:18:49 +00:00
|
|
|
|
|
|
|
if (VisAfter != NULL)
|
|
|
|
{
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GreDeleteObject(VisAfter);
|
2003-11-20 09:18:49 +00:00
|
|
|
}
|
2002-07-04 19:56:38 +00:00
|
|
|
|
2004-09-24 15:07:38 +00:00
|
|
|
if (!(WinPos.flags & SWP_NOACTIVATE))
|
2003-11-30 20:03:47 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
|
2004-09-24 15:07:38 +00:00
|
|
|
{
|
2010-05-08 15:49:02 +00:00
|
|
|
co_IntSendMessageNoWait(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntSetForegroundWindow(Window);
|
2004-09-24 15:07:38 +00:00
|
|
|
}
|
2003-11-30 20:03:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-23 08:48:59 +00:00
|
|
|
if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
|
2010-05-19 09:18:24 +00:00
|
|
|
{
|
|
|
|
/* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set
|
|
|
|
and always contains final window position.
|
|
|
|
*/
|
|
|
|
WinPos.x = NewWindowRect.left;
|
|
|
|
WinPos.y = NewWindowRect.top;
|
|
|
|
WinPos.cx = NewWindowRect.right - NewWindowRect.left;
|
|
|
|
WinPos.cy = NewWindowRect.bottom - NewWindowRect.top;
|
2010-05-08 15:49:02 +00:00
|
|
|
co_IntSendMessageNoWait(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos);
|
2010-05-19 09:18:24 +00:00
|
|
|
}
|
2003-11-20 21:21:29 +00:00
|
|
|
|
2010-10-23 05:36:12 +00:00
|
|
|
if ( WinPos.flags & SWP_FRAMECHANGED || WinPos.flags & SWP_STATECHANGED ||
|
|
|
|
!(WinPos.flags & SWP_NOCLIENTSIZE) || !(WinPos.flags & SWP_NOCLIENTMOVE) )
|
|
|
|
{
|
|
|
|
PWND pWnd = UserGetWindowObject(WinPos.hwnd);
|
|
|
|
if (pWnd)
|
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
|
|
|
|
}
|
|
|
|
|
2011-09-03 17:53:14 +00:00
|
|
|
if(bPointerInWindow != IntPtInWindow(Window, gpsi->ptCursor.x, gpsi->ptCursor.y))
|
2011-06-07 20:09:04 +00:00
|
|
|
{
|
|
|
|
/* Generate mouse move message */
|
|
|
|
MSG msg;
|
|
|
|
msg.message = WM_MOUSEMOVE;
|
2011-10-21 21:23:51 +00:00
|
|
|
msg.wParam = UserGetMouseButtonsState();
|
2011-06-07 20:09:04 +00:00
|
|
|
msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
|
|
|
|
msg.pt = gpsi->ptCursor;
|
|
|
|
co_MsqInsertMouseMessage(&msg, 0, 0, TRUE);
|
|
|
|
}
|
|
|
|
|
2003-11-20 09:18:49 +00:00
|
|
|
return TRUE;
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 21:13:00 +00:00
|
|
|
LRESULT FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosGetNonClientSize(PWND Window, RECT* WindowRect, RECT* ClientRect)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
LRESULT Result;
|
2004-03-23 21:30:18 +00:00
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
ASSERT_REFS_CO(Window);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
*ClientRect = *WindowRect;
|
2011-12-10 07:41:56 +00:00
|
|
|
Result = co_IntSendMessage(Window->head.h, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect);
|
2004-03-23 21:30:18 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
FixClientRect(ClientRect, WindowRect);
|
2004-03-23 21:30:18 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return Result;
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
2010-05-31 17:58:05 +00:00
|
|
|
void FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosSendSizeMove(PWND Wnd)
|
2010-05-31 17:58:05 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
RECTL Rect;
|
|
|
|
LPARAM lParam;
|
2010-05-31 17:58:05 +00:00
|
|
|
WPARAM wParam = SIZE_RESTORED;
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
IntGetClientRect(Wnd, &Rect);
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
Wnd->state &= ~WNDS_SENDSIZEMOVEMSGS;
|
2010-05-31 17:58:05 +00:00
|
|
|
if (Wnd->style & WS_MAXIMIZE)
|
|
|
|
{
|
|
|
|
wParam = SIZE_MAXIMIZED;
|
|
|
|
}
|
|
|
|
else if (Wnd->style & WS_MINIMIZE)
|
|
|
|
{
|
|
|
|
wParam = SIZE_MINIMIZED;
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_SIZE, wParam, MAKELONG(Rect.right-Rect.left, Rect.bottom-Rect.top));
|
|
|
|
|
|
|
|
if (Wnd->spwndParent == UserGetDesktopWindow()) // Wnd->spwndParent->fnid != FNID_DESKTOP )
|
|
|
|
lParam = MAKELONG(Wnd->rcClient.left, Wnd->rcClient.top);
|
|
|
|
else
|
|
|
|
lParam = MAKELONG(Wnd->rcClient.left-Wnd->spwndParent->rcClient.left, Wnd->rcClient.top-Wnd->spwndParent->rcClient.top);
|
|
|
|
|
|
|
|
co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_MOVE, 0, lParam);
|
2010-10-11 03:41:41 +00:00
|
|
|
IntEngWindowChanged(Wnd, WOC_RGN_CLIENT);
|
2010-05-31 17:58:05 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
BOOLEAN FASTCALL
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosShowWindow(PWND Wnd, INT Cmd)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
BOOLEAN WasVisible;
|
|
|
|
UINT Swp = 0;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL NewPos;
|
2005-09-07 21:25:42 +00:00
|
|
|
BOOLEAN ShowFlag;
|
2011-12-10 06:08:29 +00:00
|
|
|
LONG style;
|
2005-09-07 21:25:42 +00:00
|
|
|
// HRGN VisibleRgn;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
ASSERT_REFS_CO(Wnd);
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
|
2009-07-20 23:18:16 +00:00
|
|
|
WasVisible = (Wnd->style & WS_VISIBLE) != 0;
|
2011-12-10 06:08:29 +00:00
|
|
|
style = Wnd->style;
|
2002-05-06 22:20:32 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
switch (Cmd)
|
|
|
|
{
|
|
|
|
case SW_HIDE:
|
|
|
|
{
|
|
|
|
if (!WasVisible)
|
|
|
|
{
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
|
2010-10-11 03:41:41 +00:00
|
|
|
if (Wnd->head.h != UserGetActiveWindow())
|
2005-09-07 21:25:42 +00:00
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
|
|
|
break;
|
|
|
|
}
|
2002-05-06 22:20:32 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
case SW_SHOWMINNOACTIVE:
|
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
|
|
|
/* Fall through. */
|
|
|
|
case SW_SHOWMINIMIZED:
|
2008-07-16 02:06:05 +00:00
|
|
|
Swp |= SWP_SHOWWINDOW;
|
|
|
|
/* Fall through. */
|
|
|
|
case SW_MINIMIZE:
|
|
|
|
{
|
|
|
|
Swp |= SWP_NOACTIVATE;
|
2011-12-10 06:08:29 +00:00
|
|
|
if (!(style & WS_MINIMIZE))
|
2008-07-16 02:06:05 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
Swp |= co_WinPosMinMaximize(Wnd, SW_MINIMIZE, &NewPos) |
|
2008-07-16 02:06:05 +00:00
|
|
|
SWP_FRAMECHANGED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Swp |= SWP_NOSIZE | SWP_NOMOVE;
|
|
|
|
if (! WasVisible)
|
|
|
|
{
|
|
|
|
Swp |= SWP_FRAMECHANGED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-05-06 22:20:32 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
case SW_SHOWMAXIMIZED:
|
2008-07-16 02:06:05 +00:00
|
|
|
{
|
|
|
|
Swp |= SWP_SHOWWINDOW;
|
2011-12-10 06:08:29 +00:00
|
|
|
if (!(style & WS_MAXIMIZE))
|
2008-07-16 02:06:05 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
Swp |= co_WinPosMinMaximize(Wnd, SW_MAXIMIZE, &NewPos) |
|
2008-07-16 02:06:05 +00:00
|
|
|
SWP_FRAMECHANGED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Swp |= SWP_NOSIZE | SWP_NOMOVE;
|
|
|
|
if (! WasVisible)
|
|
|
|
{
|
|
|
|
Swp |= SWP_FRAMECHANGED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-05-06 22:20:32 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
case SW_SHOWNA:
|
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
|
|
|
/* Fall through. */
|
|
|
|
case SW_SHOW:
|
2007-11-16 12:57:01 +00:00
|
|
|
if (WasVisible) return(TRUE); // Nothing to do!
|
2005-09-07 21:25:42 +00:00
|
|
|
Swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
|
|
|
|
/* Don't activate the topmost window. */
|
2011-12-10 06:08:29 +00:00
|
|
|
if (style & WS_CHILD) Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
2005-09-07 21:25:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SW_SHOWNOACTIVATE:
|
2011-12-10 07:41:56 +00:00
|
|
|
Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
|
2008-07-16 02:06:05 +00:00
|
|
|
//Swp |= SWP_NOZORDER;
|
2007-03-08 13:31:33 +00:00
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
2005-09-07 21:25:42 +00:00
|
|
|
/* Fall through. */
|
|
|
|
case SW_SHOWNORMAL:
|
|
|
|
case SW_SHOWDEFAULT:
|
|
|
|
case SW_RESTORE:
|
2008-07-16 02:06:05 +00:00
|
|
|
Swp |= SWP_SHOWWINDOW;
|
2011-12-10 06:08:29 +00:00
|
|
|
if (style & (WS_MINIMIZE | WS_MAXIMIZE))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
Swp |= co_WinPosMinMaximize(Wnd, SW_RESTORE, &NewPos) |
|
2008-07-16 02:06:05 +00:00
|
|
|
SWP_FRAMECHANGED;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Swp |= SWP_NOSIZE | SWP_NOMOVE;
|
2008-07-16 02:06:05 +00:00
|
|
|
if (! WasVisible)
|
|
|
|
{
|
|
|
|
Swp |= SWP_FRAMECHANGED;
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowFlag = (Cmd != SW_HIDE);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (ShowFlag != WasVisible)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
co_IntSendMessageNoWait(Wnd->head.h, WM_SHOWWINDOW, ShowFlag, 0);
|
2011-12-10 06:08:29 +00:00
|
|
|
if (!(Wnd->state2 & WNDS2_WIN31COMPAT))
|
|
|
|
co_IntSendMessageNoWait(Wnd->head.h, WM_SETVISIBLE, ShowFlag, 0);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We can't activate a child window */
|
2009-07-20 23:18:16 +00:00
|
|
|
if ((Wnd->style & WS_CHILD) &&
|
2007-11-15 22:08:13 +00:00
|
|
|
!(Wnd->ExStyle & WS_EX_MDICHILD))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2003-11-21 17:01:16 +00:00
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2011-12-10 06:08:29 +00:00
|
|
|
#if 0 // Explorer issues with common controls. Someone does not know how CS_SAVEBITS works.
|
|
|
|
if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
|
|
|
|
Wnd->pcls->style & CS_SAVEBITS &&
|
|
|
|
((Cmd == SW_SHOW) || (Cmd == SW_NORMAL)))
|
|
|
|
{
|
|
|
|
co_IntSetActiveWindow(Wnd);
|
|
|
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
|
|
|
}
|
|
|
|
#endif
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosSetWindowPos(Wnd, 0 != (Wnd->ExStyle & WS_EX_TOPMOST)
|
2005-09-07 21:25:42 +00:00
|
|
|
? HWND_TOPMOST : HWND_TOP,
|
|
|
|
NewPos.left, NewPos.top, NewPos.right, NewPos.bottom, LOWORD(Swp));
|
2003-11-21 17:01:16 +00:00
|
|
|
|
2010-05-08 15:49:02 +00:00
|
|
|
if ((Cmd == SW_HIDE) || (Cmd == SW_MINIMIZE))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND ThreadFocusWindow;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2003-11-21 17:01:16 +00:00
|
|
|
/* FIXME: This will cause the window to be activated irrespective
|
|
|
|
* of whether it is owned by the same thread. Has to be done
|
|
|
|
* asynchronously.
|
|
|
|
*/
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if (Wnd->head.h == UserGetActiveWindow())
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosActivateOtherWindow(Wnd);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2003-11-21 17:01:16 +00:00
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
|
2011-12-14 04:07:06 +00:00
|
|
|
// Temp HACK
|
2005-09-11 14:48:32 +00:00
|
|
|
ThreadFocusWindow = UserGetWindowObject(IntGetThreadFocusWindow());
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2003-11-21 17:01:16 +00:00
|
|
|
/* Revert focus to parent */
|
2011-12-10 06:08:29 +00:00
|
|
|
/* if (ThreadFocusWindow && (Wnd == ThreadFocusWindow ||
|
2010-10-11 03:41:41 +00:00
|
|
|
IntIsChildWindow(Wnd, ThreadFocusWindow)))
|
2011-12-10 06:08:29 +00:00
|
|
|
*/
|
|
|
|
if (Wnd == ThreadFocusWindow)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-14 04:07:06 +00:00
|
|
|
// FIXME: As long as we have ref on Window, we also, indirectly, have ref on parent...
|
2010-10-11 03:41:41 +00:00
|
|
|
co_UserSetFocus(Wnd->spwndParent);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-21 17:01:16 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* FIXME: Check for window destruction. */
|
2003-11-18 20:49:39 +00:00
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if ((Wnd->state & WNDS_SENDSIZEMOVEMSGS) &&
|
|
|
|
!(Wnd->state2 & WNDS2_INDESTROY))
|
2007-07-19 12:43:54 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
co_WinPosSendSizeMove(Wnd);
|
2007-07-19 12:43:54 +00:00
|
|
|
}
|
|
|
|
|
2011-12-10 06:08:29 +00:00
|
|
|
/* if previous state was minimized Windows sets focus to the window */
|
|
|
|
if (style & WS_MINIMIZE) co_UserSetFocus(Wnd);
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return(WasVisible);
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
2002-10-31 00:03:31 +00:00
|
|
|
|
2005-09-11 14:48:32 +00:00
|
|
|
static
|
2010-11-22 20:10:56 +00:00
|
|
|
PWND FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_WinPosSearchChildren(
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND ScopeWin,
|
2005-09-11 14:48:32 +00:00
|
|
|
POINT *Point,
|
|
|
|
USHORT *HitTest
|
|
|
|
)
|
2002-10-31 00:03:31 +00:00
|
|
|
{
|
2010-11-22 20:10:56 +00:00
|
|
|
PWND pwndChild;
|
|
|
|
HWND *List, *phWnd;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
if (!(ScopeWin->style & WS_VISIBLE))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
if ((ScopeWin->style & WS_DISABLED))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2004-05-13 20:46:28 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
UserReferenceObject(ScopeWin);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
if (Point->x - ScopeWin->rcClient.left < ScopeWin->rcClient.right &&
|
|
|
|
Point->y - ScopeWin->rcClient.top < ScopeWin->rcClient.bottom )
|
|
|
|
{
|
|
|
|
List = IntWinListChildren(ScopeWin);
|
|
|
|
if(List)
|
|
|
|
{
|
|
|
|
for (phWnd = List; *phWnd; ++phWnd)
|
2005-09-11 14:48:32 +00:00
|
|
|
{
|
2010-11-22 20:10:56 +00:00
|
|
|
if (!(pwndChild = UserGetWindowObject(*phWnd)))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest);
|
|
|
|
|
|
|
|
if(pwndChild != NULL)
|
|
|
|
{
|
|
|
|
/* We found a window. Don't send any more WM_NCHITTEST messages */
|
2011-06-06 21:18:53 +00:00
|
|
|
ExFreePool(List);
|
2010-11-22 20:10:56 +00:00
|
|
|
UserDereferenceObject(ScopeWin);
|
|
|
|
return pwndChild;
|
|
|
|
}
|
2005-09-11 14:48:32 +00:00
|
|
|
}
|
2011-09-18 12:33:38 +00:00
|
|
|
ExFreePool(List);
|
2010-11-22 20:10:56 +00:00
|
|
|
}
|
|
|
|
}
|
2004-05-13 20:46:28 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
*HitTest = co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0,
|
|
|
|
MAKELONG(Point->x, Point->y));
|
|
|
|
if ((*HitTest) == (USHORT)HTTRANSPARENT)
|
|
|
|
{
|
|
|
|
UserDereferenceObject(ScopeWin);
|
|
|
|
return NULL;
|
|
|
|
}
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
return ScopeWin;
|
2002-10-31 00:03:31 +00:00
|
|
|
}
|
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
PWND FASTCALL
|
|
|
|
co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest)
|
2002-10-31 00:03:31 +00:00
|
|
|
{
|
2010-11-22 20:10:56 +00:00
|
|
|
PWND Window;
|
2005-09-07 21:25:42 +00:00
|
|
|
POINT Point = *WinPoint;
|
2010-11-22 20:10:56 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
if( ScopeWin == NULL )
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-11-22 20:10:56 +00:00
|
|
|
ScopeWin = UserGetDesktopWindow();
|
|
|
|
if(ScopeWin == NULL)
|
|
|
|
return NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2002-10-31 00:03:31 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
*HitTest = HTNOWHERE;
|
2002-10-31 00:03:31 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
ASSERT_REFS_CO(ScopeWin);
|
|
|
|
UserRefObjectCo(ScopeWin, &Ref);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
UserDerefObjectCo(ScopeWin);
|
|
|
|
if(Window)
|
|
|
|
ASSERT_REFS_CO(Window);
|
|
|
|
ASSERT_REFS_CO(ScopeWin);
|
2004-02-24 01:30:58 +00:00
|
|
|
|
2010-11-22 20:10:56 +00:00
|
|
|
return Window;
|
2002-10-31 00:03:31 +00:00
|
|
|
}
|
2003-07-27 11:54:42 +00:00
|
|
|
|
2011-03-18 22:41:22 +00:00
|
|
|
HDWP
|
|
|
|
FASTCALL
|
|
|
|
IntDeferWindowPos( HDWP hdwp,
|
|
|
|
HWND hwnd,
|
|
|
|
HWND hwndAfter,
|
|
|
|
INT x,
|
|
|
|
INT y,
|
|
|
|
INT cx,
|
|
|
|
INT cy,
|
|
|
|
UINT flags )
|
|
|
|
{
|
|
|
|
PSMWP pDWP;
|
|
|
|
int i;
|
|
|
|
HDWP retvalue = hdwp;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("hdwp %p, hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
|
2011-03-18 22:41:22 +00:00
|
|
|
hdwp, hwnd, hwndAfter, x, y, cx, cy, flags);
|
|
|
|
|
|
|
|
if (flags & ~(SWP_NOSIZE | SWP_NOMOVE |
|
|
|
|
SWP_NOZORDER | SWP_NOREDRAW |
|
|
|
|
SWP_NOACTIVATE | SWP_NOCOPYBITS |
|
|
|
|
SWP_NOOWNERZORDER|SWP_SHOWWINDOW |
|
|
|
|
SWP_HIDEWINDOW | SWP_FRAMECHANGED))
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
return NULL;
|
2011-03-18 22:41:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(pDWP = (PSMWP)UserGetObject(gHandleTable, hdwp, otSMWP)))
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_DWP_HANDLE);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < pDWP->ccvr; i++)
|
|
|
|
{
|
|
|
|
if (pDWP->acvr[i].pos.hwnd == hwnd)
|
|
|
|
{
|
|
|
|
/* Merge with the other changes */
|
|
|
|
if (!(flags & SWP_NOZORDER))
|
|
|
|
{
|
|
|
|
pDWP->acvr[i].pos.hwndInsertAfter = hwndAfter;
|
|
|
|
}
|
|
|
|
if (!(flags & SWP_NOMOVE))
|
|
|
|
{
|
|
|
|
pDWP->acvr[i].pos.x = x;
|
|
|
|
pDWP->acvr[i].pos.y = y;
|
|
|
|
}
|
|
|
|
if (!(flags & SWP_NOSIZE))
|
|
|
|
{
|
|
|
|
pDWP->acvr[i].pos.cx = cx;
|
|
|
|
pDWP->acvr[i].pos.cy = cy;
|
|
|
|
}
|
|
|
|
pDWP->acvr[i].pos.flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
|
|
|
|
SWP_NOZORDER | SWP_NOREDRAW |
|
|
|
|
SWP_NOACTIVATE | SWP_NOCOPYBITS|
|
|
|
|
SWP_NOOWNERZORDER);
|
|
|
|
pDWP->acvr[i].pos.flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
|
|
|
|
SWP_FRAMECHANGED);
|
|
|
|
goto END;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pDWP->ccvr >= pDWP->ccvrAlloc)
|
|
|
|
{
|
|
|
|
PCVR newpos = ExAllocatePoolWithTag(PagedPool, pDWP->ccvrAlloc * 2 * sizeof(CVR), USERTAG_SWP);
|
|
|
|
if (!newpos)
|
|
|
|
{
|
|
|
|
retvalue = NULL;
|
|
|
|
goto END;
|
|
|
|
}
|
|
|
|
RtlZeroMemory(newpos, pDWP->ccvrAlloc * 2 * sizeof(CVR));
|
|
|
|
RtlCopyMemory(newpos, pDWP->acvr, pDWP->ccvrAlloc * sizeof(CVR));
|
|
|
|
ExFreePoolWithTag(pDWP->acvr, USERTAG_SWP);
|
|
|
|
pDWP->ccvrAlloc *= 2;
|
|
|
|
pDWP->acvr = newpos;
|
|
|
|
}
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.hwnd = hwnd;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.hwndInsertAfter = hwndAfter;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.x = x;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.y = y;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.cx = cx;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.cy = cy;
|
|
|
|
pDWP->acvr[pDWP->ccvr].pos.flags = flags;
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
pDWP->acvr[pDWP->ccvr].hrgnClip = NULL;
|
2011-03-18 22:41:22 +00:00
|
|
|
pDWP->acvr[pDWP->ccvr].hrgnInterMonitor = NULL;
|
|
|
|
pDWP->ccvr++;
|
|
|
|
END:
|
|
|
|
return retvalue;
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
BOOL FASTCALL IntEndDeferWindowPosEx( HDWP hdwp, BOOL sAsync )
|
2011-03-18 22:41:22 +00:00
|
|
|
{
|
|
|
|
PSMWP pDWP;
|
|
|
|
PCVR winpos;
|
|
|
|
BOOL res = TRUE;
|
|
|
|
int i;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("%p\n", hdwp);
|
2011-03-18 22:41:22 +00:00
|
|
|
|
|
|
|
if (!(pDWP = (PSMWP)UserGetObject(gHandleTable, hdwp, otSMWP)))
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_DWP_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, winpos = pDWP->acvr; res && i < pDWP->ccvr; i++, winpos++)
|
|
|
|
{
|
2011-09-18 12:33:38 +00:00
|
|
|
PWND pwnd;
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
|
2011-03-18 22:41:22 +00:00
|
|
|
winpos->pos.hwnd, winpos->pos.hwndInsertAfter, winpos->pos.x, winpos->pos.y,
|
|
|
|
winpos->pos.cx, winpos->pos.cy, winpos->pos.flags);
|
2011-09-18 12:33:38 +00:00
|
|
|
|
|
|
|
pwnd = UserGetWindowObject(winpos->pos.hwnd);
|
2011-12-10 06:08:29 +00:00
|
|
|
if (!pwnd)
|
|
|
|
continue;
|
2011-03-18 22:41:22 +00:00
|
|
|
|
2011-09-18 12:33:38 +00:00
|
|
|
UserRefObjectCo(pwnd, &Ref);
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if ( sAsync )
|
|
|
|
{
|
|
|
|
LRESULT lRes;
|
|
|
|
PWINDOWPOS ppos = ExAllocatePoolWithTag(PagedPool, sizeof(WINDOWPOS), USERTAG_SWP);
|
|
|
|
if ( ppos )
|
|
|
|
{
|
|
|
|
*ppos = winpos->pos;
|
|
|
|
/* Yes it's a pointer inside Win32k! */
|
|
|
|
lRes = co_IntSendMessageNoWait( winpos->pos.hwnd, WM_ASYNC_SETWINDOWPOS, 0, (LPARAM)ppos);
|
|
|
|
/* We handle this the same way as Event Hooks and Hooks. */
|
|
|
|
if ( -1 == (int) lRes )
|
|
|
|
{
|
|
|
|
ExFreePoolWithTag(ppos, USERTAG_SWP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
res = co_WinPosSetWindowPos( pwnd,
|
|
|
|
winpos->pos.hwndInsertAfter,
|
|
|
|
winpos->pos.x,
|
|
|
|
winpos->pos.y,
|
|
|
|
winpos->pos.cx,
|
|
|
|
winpos->pos.cy,
|
|
|
|
winpos->pos.flags);
|
2011-09-18 12:33:38 +00:00
|
|
|
|
|
|
|
UserDerefObjectCo(pwnd);
|
2011-03-18 22:41:22 +00:00
|
|
|
}
|
|
|
|
ExFreePoolWithTag(pDWP->acvr, USERTAG_SWP);
|
2011-05-13 08:34:24 +00:00
|
|
|
UserDereferenceObject(pDWP);
|
2011-03-18 22:41:22 +00:00
|
|
|
UserDeleteObject(hdwp, otSMWP);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
|
2011-03-30 01:00:28 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
HWND APIENTRY
|
|
|
|
NtUserChildWindowFromPointEx(HWND hwndParent,
|
|
|
|
LONG x,
|
|
|
|
LONG y,
|
|
|
|
UINT uiFlags)
|
|
|
|
{
|
|
|
|
PWND Parent;
|
|
|
|
POINTL Pt;
|
|
|
|
HWND Ret;
|
|
|
|
HWND *List, *phWnd;
|
|
|
|
|
|
|
|
if(!(Parent = UserGetWindowObject(hwndParent)))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pt.x = x;
|
|
|
|
Pt.y = y;
|
|
|
|
|
|
|
|
if(Parent->head.h != IntGetDesktopWindow())
|
|
|
|
{
|
|
|
|
Pt.x += Parent->rcClient.left;
|
|
|
|
Pt.y += Parent->rcClient.top;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!IntPtInWindow(Parent, Pt.x, Pt.y))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ret = Parent->head.h;
|
|
|
|
if((List = IntWinListChildren(Parent)))
|
|
|
|
{
|
|
|
|
for(phWnd = List; *phWnd; phWnd++)
|
|
|
|
{
|
|
|
|
PWND Child;
|
|
|
|
if((Child = UserGetWindowObject(*phWnd)))
|
|
|
|
{
|
|
|
|
if(!(Child->style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((Child->style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((Child->ExStyle & WS_EX_TRANSPARENT) && (uiFlags & CWP_SKIPTRANSPARENT))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(IntPtInWindow(Child, Pt.x, Pt.y))
|
|
|
|
{
|
|
|
|
Ret = Child->head.h;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExFreePool(List);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
2011-03-18 22:41:22 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserEndDeferWindowPosEx(HDWP WinPosInfo,
|
|
|
|
DWORD Unknown1)
|
|
|
|
{
|
|
|
|
BOOL Ret;
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserEndDeferWindowPosEx\n");
|
2011-03-18 22:41:22 +00:00
|
|
|
UserEnterExclusive();
|
2011-12-10 07:41:56 +00:00
|
|
|
Ret = IntEndDeferWindowPosEx(WinPosInfo, (BOOL)Unknown1);
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserEndDeferWindowPosEx, ret=%i\n", Ret);
|
2011-03-18 22:41:22 +00:00
|
|
|
UserLeave();
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
HDWP APIENTRY
|
|
|
|
NtUserDeferWindowPos(HDWP WinPosInfo,
|
|
|
|
HWND Wnd,
|
|
|
|
HWND WndInsertAfter,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int cx,
|
|
|
|
int cy,
|
|
|
|
UINT Flags)
|
|
|
|
{
|
|
|
|
PWND pWnd, pWndIA;
|
|
|
|
HDWP Ret = NULL;
|
|
|
|
UINT Tmp = ~(SWP_ASYNCWINDOWPOS|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_NOREPOSITION|
|
|
|
|
SWP_NOCOPYBITS|SWP_HIDEWINDOW|SWP_SHOWWINDOW|SWP_FRAMECHANGED|
|
|
|
|
SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE);
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserDeferWindowPos\n");
|
2011-03-18 22:41:22 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if ( Flags & Tmp )
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_FLAGS);
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pWnd = UserGetWindowObject(Wnd);
|
2011-03-20 01:09:15 +00:00
|
|
|
if ( !pWnd || // FIXME:
|
|
|
|
pWnd == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
pWnd == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
2011-03-18 22:41:22 +00:00
|
|
|
{
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( WndInsertAfter &&
|
|
|
|
WndInsertAfter != HWND_BOTTOM &&
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
WndInsertAfter != HWND_TOPMOST &&
|
2011-03-18 22:41:22 +00:00
|
|
|
WndInsertAfter != HWND_NOTOPMOST )
|
|
|
|
{
|
|
|
|
pWndIA = UserGetWindowObject(WndInsertAfter);
|
|
|
|
if ( !pWndIA ||
|
|
|
|
pWndIA == IntGetDesktopWindow() ||
|
|
|
|
pWndIA == IntGetMessageWindow() )
|
|
|
|
{
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Ret = IntDeferWindowPos(WinPosInfo, Wnd, WndInsertAfter, x, y, cx, cy, Flags);
|
|
|
|
|
|
|
|
Exit:
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserDeferWindowPos, ret=%i\n", Ret);
|
2011-03-18 22:41:22 +00:00
|
|
|
UserLeave();
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
return Ret;
|
2011-03-18 22:41:22 +00:00
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
DWORD APIENTRY
|
|
|
|
NtUserGetInternalWindowPos( HWND hWnd,
|
|
|
|
LPRECT rectWnd,
|
|
|
|
LPPOINT ptIcon)
|
|
|
|
{
|
|
|
|
PWND Window;
|
|
|
|
DWORD Ret = 0;
|
|
|
|
BOOL Hit = FALSE;
|
|
|
|
WINDOWPLACEMENT wndpl;
|
|
|
|
|
|
|
|
UserEnterShared();
|
|
|
|
|
|
|
|
if (!(Window = UserGetWindowObject(hWnd)))
|
|
|
|
{
|
|
|
|
Hit = FALSE;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
if(rectWnd)
|
|
|
|
{
|
|
|
|
ProbeForWrite(rectWnd,
|
|
|
|
sizeof(RECT),
|
|
|
|
1);
|
|
|
|
}
|
|
|
|
if(ptIcon)
|
|
|
|
{
|
|
|
|
ProbeForWrite(ptIcon,
|
|
|
|
sizeof(POINT),
|
|
|
|
1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
SetLastNtError(_SEH2_GetExceptionCode());
|
|
|
|
Hit = TRUE;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
wndpl.length = sizeof(WINDOWPLACEMENT);
|
|
|
|
|
|
|
|
if (IntGetWindowPlacement(Window, &wndpl) && !Hit)
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
if (rectWnd)
|
|
|
|
{
|
|
|
|
RtlCopyMemory(rectWnd, &wndpl.rcNormalPosition , sizeof(RECT));
|
|
|
|
}
|
|
|
|
if (ptIcon)
|
|
|
|
{
|
|
|
|
RtlCopyMemory(ptIcon, &wndpl.ptMinPosition, sizeof(POINT));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
SetLastNtError(_SEH2_GetExceptionCode());
|
|
|
|
Hit = TRUE;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!Hit) Ret = wndpl.showCmd;
|
|
|
|
}
|
|
|
|
Exit:
|
|
|
|
UserLeave();
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserGetWindowPlacement(HWND hWnd,
|
|
|
|
WINDOWPLACEMENT *lpwndpl)
|
|
|
|
{
|
|
|
|
PWND Wnd;
|
|
|
|
WINDOWPLACEMENT Safepl;
|
|
|
|
NTSTATUS Status;
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
|
|
|
|
TRACE("Enter NtUserGetWindowPlacement\n");
|
|
|
|
UserEnterShared();
|
|
|
|
|
|
|
|
if (!(Wnd = UserGetWindowObject(hWnd)))
|
|
|
|
{
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
if(Safepl.length != sizeof(WINDOWPLACEMENT))
|
|
|
|
{
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
IntGetWindowPlacement(Wnd, &Safepl);
|
|
|
|
|
|
|
|
Status = MmCopyToCaller(lpwndpl, &Safepl, sizeof(WINDOWPLACEMENT));
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
RETURN( TRUE);
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
TRACE("Leave NtUserGetWindowPlacement, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
2011-08-26 03:02:00 +00:00
|
|
|
DWORD
|
|
|
|
APIENTRY
|
|
|
|
NtUserMinMaximize(
|
|
|
|
HWND hWnd,
|
|
|
|
UINT cmd, // Wine SW_ commands
|
|
|
|
BOOL Hide)
|
|
|
|
{
|
|
|
|
RECTL NewPos;
|
|
|
|
UINT SwFlags;
|
|
|
|
PWND pWnd;
|
|
|
|
|
|
|
|
TRACE("Enter NtUserMinMaximize\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
pWnd = UserGetWindowObject(hWnd);
|
|
|
|
if ( !pWnd || // FIXME:
|
|
|
|
pWnd == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
pWnd == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( cmd > SW_MAX || pWnd->state2 & WNDS2_INDESTROY)
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
co_WinPosMinMaximize(pWnd, cmd, &NewPos);
|
|
|
|
|
|
|
|
SwFlags = Hide ? SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED : SWP_NOZORDER|SWP_FRAMECHANGED;
|
|
|
|
|
|
|
|
co_WinPosSetWindowPos( pWnd,
|
|
|
|
NULL,
|
|
|
|
NewPos.left,
|
|
|
|
NewPos.top,
|
|
|
|
NewPos.right,
|
|
|
|
NewPos.bottom,
|
|
|
|
SwFlags);
|
|
|
|
|
|
|
|
co_WinPosShowWindow(pWnd, cmd);
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
TRACE("Leave NtUserMinMaximize\n");
|
|
|
|
UserLeave();
|
|
|
|
return 0; // Always NULL?
|
|
|
|
}
|
|
|
|
|
2011-03-20 01:09:15 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserMoveWindow(
|
|
|
|
HWND hWnd,
|
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
int nWidth,
|
|
|
|
int nHeight,
|
|
|
|
BOOL bRepaint)
|
|
|
|
{
|
|
|
|
return NtUserSetWindowPos(hWnd, 0, X, Y, nWidth, nHeight,
|
|
|
|
(bRepaint ? SWP_NOZORDER | SWP_NOACTIVATE :
|
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserSetWindowPos(
|
|
|
|
HWND hWnd,
|
|
|
|
HWND hWndInsertAfter,
|
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
int cx,
|
|
|
|
int cy,
|
|
|
|
UINT uFlags)
|
|
|
|
{
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
PWND Window, pWndIA;
|
|
|
|
BOOL ret;
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserSetWindowPos\n");
|
2011-03-20 01:09:15 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
|
|
|
|
Window == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Window == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( hWndInsertAfter &&
|
|
|
|
hWndInsertAfter != HWND_BOTTOM &&
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
hWndInsertAfter != HWND_TOPMOST &&
|
2011-03-20 01:09:15 +00:00
|
|
|
hWndInsertAfter != HWND_NOTOPMOST )
|
|
|
|
{
|
|
|
|
pWndIA = UserGetWindowObject(hWndInsertAfter);
|
|
|
|
if ( !pWndIA ||
|
|
|
|
pWndIA == IntGetDesktopWindow() ||
|
|
|
|
pWndIA == IntGetMessageWindow() )
|
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
|
|
|
|
if (!(uFlags & SWP_NOMOVE))
|
|
|
|
{
|
|
|
|
if (X < -32768) X = -32768;
|
|
|
|
else if (X > 32767) X = 32767;
|
|
|
|
if (Y < -32768) Y = -32768;
|
|
|
|
else if (Y > 32767) Y = 32767;
|
|
|
|
}
|
|
|
|
if (!(uFlags & SWP_NOSIZE))
|
|
|
|
{
|
|
|
|
if (cx < 0) cx = 0;
|
|
|
|
else if (cx > 32767) cx = 32767;
|
|
|
|
if (cy < 0) cy = 0;
|
|
|
|
else if (cy > 32767) cy = 32767;
|
|
|
|
}
|
|
|
|
|
|
|
|
UserRefObjectCo(Window, &Ref);
|
|
|
|
ret = co_WinPosSetWindowPos(Window, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
|
|
|
UserDerefObjectCo(Window);
|
|
|
|
|
|
|
|
RETURN(ret);
|
|
|
|
|
|
|
|
CLEANUP:
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserSetWindowPos, ret=%i\n",_ret_);
|
2011-03-20 01:09:15 +00:00
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
INT APIENTRY
|
|
|
|
NtUserSetWindowRgn(
|
|
|
|
HWND hWnd,
|
|
|
|
HRGN hRgn,
|
|
|
|
BOOL bRedraw)
|
|
|
|
{
|
|
|
|
HRGN hrgnCopy;
|
|
|
|
PWND Window;
|
|
|
|
INT flags = (SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE);
|
|
|
|
BOOLEAN Ret = FALSE;
|
|
|
|
DECLARE_RETURN(INT);
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserSetWindowRgn\n");
|
2011-03-20 01:09:15 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
|
|
|
|
Window == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Window == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN( 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hRgn) // The region will be deleted in user32.
|
|
|
|
{
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
if (GreIsHandleValid(hRgn))
|
2011-03-20 01:09:15 +00:00
|
|
|
{
|
|
|
|
hrgnCopy = IntSysCreateRectRgn(0, 0, 0, 0);
|
2011-12-10 07:41:56 +00:00
|
|
|
/* 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);
|
2011-03-20 01:09:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
RETURN( 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hrgnCopy = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Window->hrgnClip)
|
|
|
|
{
|
|
|
|
/* Delete no longer needed region handle */
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
IntGdiSetRegionOwner(Window->hrgnClip, GDI_OBJ_HMGR_POWNED);
|
2011-03-20 01:09:15 +00:00
|
|
|
GreDeleteObject(Window->hrgnClip);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hrgnCopy)
|
|
|
|
{
|
|
|
|
/* Set public ownership */
|
|
|
|
IntGdiSetRegionOwner(hrgnCopy, GDI_OBJ_HMGR_PUBLIC);
|
|
|
|
}
|
|
|
|
Window->hrgnClip = hrgnCopy;
|
|
|
|
|
|
|
|
Ret = co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, bRedraw ? flags : (flags|SWP_NOREDRAW) );
|
|
|
|
|
|
|
|
RETURN( (INT)Ret);
|
|
|
|
|
|
|
|
CLEANUP:
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserSetWindowRgn, ret=%i\n",_ret_);
|
2011-03-20 01:09:15 +00:00
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
DWORD APIENTRY
|
|
|
|
NtUserSetInternalWindowPos(
|
|
|
|
HWND hwnd,
|
|
|
|
UINT showCmd,
|
|
|
|
LPRECT lprect,
|
|
|
|
LPPOINT lppt)
|
|
|
|
{
|
|
|
|
WINDOWPLACEMENT wndpl;
|
|
|
|
UINT flags;
|
|
|
|
PWND Wnd;
|
|
|
|
RECT rect;
|
|
|
|
POINT pt = {0};
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
|
|
|
TRACE("Enter NtUserSetWindowPlacement\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Wnd = UserGetWindowObject(hwnd)) || // FIXME:
|
|
|
|
Wnd == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Wnd == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
if (lppt)
|
|
|
|
{
|
|
|
|
ProbeForRead(lppt, sizeof(POINT), 1);
|
|
|
|
RtlCopyMemory(&pt, lppt, sizeof(POINT));
|
|
|
|
}
|
|
|
|
if (lprect)
|
|
|
|
{
|
|
|
|
ProbeForRead(lprect, sizeof(RECT), 1);
|
|
|
|
RtlCopyMemory(&rect, lprect, sizeof(RECT));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
SetLastNtError(_SEH2_GetExceptionCode());
|
|
|
|
_SEH2_YIELD(RETURN( FALSE));
|
|
|
|
}
|
|
|
|
_SEH2_END
|
|
|
|
|
|
|
|
wndpl.length = sizeof(wndpl);
|
|
|
|
wndpl.showCmd = showCmd;
|
|
|
|
wndpl.flags = flags = 0;
|
|
|
|
|
|
|
|
if ( lppt )
|
|
|
|
{
|
|
|
|
flags |= PLACE_MIN;
|
|
|
|
wndpl.flags |= WPF_SETMINPOSITION;
|
|
|
|
wndpl.ptMinPosition = pt;
|
|
|
|
}
|
|
|
|
if ( lprect )
|
|
|
|
{
|
|
|
|
flags |= PLACE_RECT;
|
|
|
|
wndpl.rcNormalPosition = rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
UserRefObjectCo(Wnd, &Ref);
|
|
|
|
IntSetWindowPlacement(Wnd, &wndpl, flags);
|
|
|
|
UserDerefObjectCo(Wnd);
|
|
|
|
RETURN(TRUE);
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
TRACE("Leave NtUserSetWindowPlacement, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
2011-03-20 01:09:15 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserSetWindowPlacement(HWND hWnd,
|
|
|
|
WINDOWPLACEMENT *lpwndpl)
|
|
|
|
{
|
|
|
|
PWND Wnd;
|
|
|
|
WINDOWPLACEMENT Safepl;
|
2011-12-10 07:41:56 +00:00
|
|
|
UINT Flags;
|
2011-03-20 01:09:15 +00:00
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserSetWindowPlacement\n");
|
2011-03-20 01:09:15 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Wnd = UserGetWindowObject(hWnd)) || // FIXME:
|
|
|
|
Wnd == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Wnd == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForRead(lpwndpl, sizeof(WINDOWPLACEMENT), 1);
|
|
|
|
RtlCopyMemory(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
SetLastNtError(_SEH2_GetExceptionCode());
|
|
|
|
_SEH2_YIELD(RETURN( FALSE));
|
|
|
|
}
|
|
|
|
_SEH2_END
|
|
|
|
|
|
|
|
if(Safepl.length != sizeof(WINDOWPLACEMENT))
|
|
|
|
{
|
|
|
|
RETURN( FALSE);
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
Flags = PLACE_MAX | PLACE_RECT;
|
|
|
|
if (Safepl.flags & WPF_SETMINPOSITION) Flags |= PLACE_MIN;
|
2011-03-20 01:09:15 +00:00
|
|
|
UserRefObjectCo(Wnd, &Ref);
|
2011-12-10 07:41:56 +00:00
|
|
|
IntSetWindowPlacement(Wnd, &Safepl, Flags);
|
2011-03-20 01:09:15 +00:00
|
|
|
UserDerefObjectCo(Wnd);
|
|
|
|
RETURN(TRUE);
|
|
|
|
|
|
|
|
CLEANUP:
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserSetWindowPlacement, ret=%i\n",_ret_);
|
2011-03-20 01:09:15 +00:00
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2011-12-10 07:41:56 +00:00
|
|
|
* @implemented
|
2011-03-20 01:09:15 +00:00
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserShowWindowAsync(HWND hWnd, LONG nCmdShow)
|
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
PWND Window;
|
|
|
|
BOOL ret;
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
|
|
|
TRACE("Enter NtUserShowWindowAsync\n");
|
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
|
|
|
|
Window == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Window == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nCmdShow > SW_MAX )
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
UserRefObjectCo(Window, &Ref);
|
|
|
|
ret = co_IntSendMessageNoWait( hWnd, WM_ASYNC_SHOWWINDOW, nCmdShow, 0 );
|
|
|
|
UserDerefObjectCo(Window);
|
|
|
|
if (-1 == (int) ret || !ret) ret = FALSE;
|
|
|
|
|
|
|
|
RETURN(ret);
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
TRACE("Leave NtUserShowWindowAsync, ret=%i\n",_ret_);
|
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
2011-03-20 01:09:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL APIENTRY
|
|
|
|
NtUserShowWindow(HWND hWnd, LONG nCmdShow)
|
|
|
|
{
|
|
|
|
PWND Window;
|
|
|
|
BOOL ret;
|
|
|
|
DECLARE_RETURN(BOOL);
|
|
|
|
USER_REFERENCE_ENTRY Ref;
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserShowWindow\n");
|
2011-03-20 01:09:15 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
|
|
|
|
Window == IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
|
|
|
|
Window == IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
|
|
|
|
{
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nCmdShow > SW_MAX || Window->state2 & WNDS2_INDESTROY)
|
|
|
|
{
|
|
|
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
RETURN(FALSE);
|
|
|
|
}
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
|
2011-03-20 01:09:15 +00:00
|
|
|
UserRefObjectCo(Window, &Ref);
|
|
|
|
ret = co_WinPosShowWindow(Window, nCmdShow);
|
|
|
|
UserDerefObjectCo(Window);
|
|
|
|
|
|
|
|
RETURN(ret);
|
|
|
|
|
|
|
|
CLEANUP:
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Leave NtUserShowWindow, ret=%i\n",_ret_);
|
2011-03-20 01:09:15 +00:00
|
|
|
UserLeave();
|
|
|
|
END_CLEANUP;
|
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
HWND APIENTRY
|
|
|
|
NtUserWindowFromPoint(LONG X, LONG Y)
|
2003-12-26 13:06:34 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
POINT pt;
|
|
|
|
HWND Ret;
|
|
|
|
PWND DesktopWindow = NULL, Window = NULL;
|
|
|
|
USHORT hittest;
|
|
|
|
DECLARE_RETURN(HWND);
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
TRACE("Enter NtUserWindowFromPoint\n");
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if ((DesktopWindow = UserGetWindowObject(IntGetDesktopWindow())))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2011-12-10 07:41:56 +00:00
|
|
|
//PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
pt.x = X;
|
|
|
|
pt.y = Y;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-12-14 04:07:06 +00:00
|
|
|
// Hmm... Threads live on desktops thus we have a reference on the desktop and indirectly the desktop window.
|
|
|
|
// It is possible this referencing is useless, though it should not hurt...
|
2011-12-10 07:41:56 +00:00
|
|
|
UserRefObjectCo(DesktopWindow, &Ref);
|
2005-09-07 20:59:26 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
//pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest);
|
2010-05-19 18:47:39 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
if(Window)
|
|
|
|
{
|
|
|
|
Ret = Window->head.h;
|
|
|
|
|
|
|
|
RETURN( Ret);
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
RETURN( NULL);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
CLEANUP:
|
|
|
|
if (Window) UserDereferenceObject(Window);
|
|
|
|
if (DesktopWindow) UserDerefObjectCo(DesktopWindow);
|
2005-09-07 20:59:26 +00:00
|
|
|
|
2011-12-10 07:41:56 +00:00
|
|
|
TRACE("Leave NtUserWindowFromPoint, ret=%i\n",_ret_);
|
2005-09-07 21:25:42 +00:00
|
|
|
UserLeave();
|
2011-12-10 07:41:56 +00:00
|
|
|
END_CLEANUP;
|
2003-12-26 13:06:34 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|