Author: gadamopoulos
Date: Tue May 18 11:01:08 2010
New Revision: 47264
URL:
http://svn.reactos.org/svn/reactos?rev=47264&view=rev
Log:
[Win32k]
- Rename co_InflateRect to RECTL_vInflateRect and move it to rect.c
- Sync WinPosFillMinMaxInfoStruct with wine
Fixes some user32:win tests
Modified:
trunk/reactos/subsystems/win32/win32k/include/rect.h
trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
trunk/reactos/subsystems/win32/win32k/objects/rect.c
Modified: trunk/reactos/subsystems/win32/win32k/include/rect.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/rect.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/rect.h [iso-8859-1] Tue May 18 11:01:08
2010
@@ -56,3 +56,7 @@
VOID
FASTCALL
RECTL_vMakeWellOrdered(RECTL *prcl);
+
+VOID
+FASTCALL
+RECTL_vInflateRect(RECTL *rect, INT dx, INT dy);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] Tue May 18 11:01:08
2010
@@ -1296,15 +1296,6 @@
return TRUE;
}
-VOID APIENTRY
-co_InflateRect(RECTL *rect, int dx, int dy)
-{
- rect->left -= dx;
- rect->top -= dy;
- rect->right += dx;
- rect->bottom += dy;
-}
-
BOOLEAN APIENTRY
intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti)
{
@@ -1334,17 +1325,17 @@
if (HAS_THICKFRAME( dwStyle, dwExStyle ))
{
/* FIXME : Note this value should exists in pWindowObject for
UserGetSystemMetrics(SM_CXFRAME) and UserGetSystemMetrics(SM_CYFRAME) */
- co_InflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) );
+ RECTL_vInflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) );
}
else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
{
/* FIXME : Note this value should exists in pWindowObject for
UserGetSystemMetrics(SM_CXDLGFRAME) and UserGetSystemMetrics(SM_CYDLGFRAME) */
- co_InflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME));
+ RECTL_vInflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME));
}
else if (HAS_THINFRAME( dwStyle, dwExStyle))
{
/* FIXME : Note this value should exists in pWindowObject for
UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
- co_InflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) );
+ RECTL_vInflateRect( &bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) );
}
/* We have additional border information if the window
@@ -1355,13 +1346,13 @@
if (dwExStyle & WS_EX_CLIENTEDGE)
{
/* FIXME : Note this value should exists in pWindowObject for
UserGetSystemMetrics(SM_CXEDGE) and UserGetSystemMetrics(SM_CYEDGE) */
- co_InflateRect (&bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE));
+ RECTL_vInflateRect (&bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE));
}
if (dwExStyle & WS_EX_STATICEDGE)
{
/* FIXME : Note this value should exists in pWindowObject for
UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
- co_InflateRect (&bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER));
+ RECTL_vInflateRect (&bti->rcTitleBar,
-UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER));
}
}
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Tue May 18 11:01:08
2010
@@ -400,36 +400,120 @@
return(SwpFlags);
}
+BOOL
+UserHasWindowEdge(DWORD Style, DWORD ExStyle)
+{
+ 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;
+}
+
+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);
+}
+
+BOOL WINAPI
+UserAdjustWindowRectEx(LPRECT lpRect,
+ DWORD dwStyle,
+ BOOL bMenu,
+ DWORD dwExStyle)
+{
+ SIZE BorderSize;
+
+ if (bMenu)
+ {
+ lpRect->top -= UserGetSystemMetrics(SM_CYMENU);
+ }
+ if ((dwStyle & WS_CAPTION) == WS_CAPTION)
+ {
+ if (dwExStyle & WS_EX_TOOLWINDOW)
+ lpRect->top -= UserGetSystemMetrics(SM_CYSMCAPTION);
+ else
+ lpRect->top -= UserGetSystemMetrics(SM_CYCAPTION);
+ }
+ UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE);
+ RECTL_vInflateRect(
+ lpRect,
+ BorderSize.cx,
+ BorderSize.cy);
+
+ return TRUE;
+}
+
static
VOID FASTCALL
WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info)
{
- UINT XInc, YInc;
- RECTL WorkArea;
- PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
- PDESKTOP Desktop = pti->rpdesk; /* Or rather get it from the window? */
-
- IntGetDesktopWorkArea(Desktop, &WorkArea);
-
- /* Get default values. */
- Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK);
- Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK);
-
- IntGetWindowBorderMeasures(Window, &XInc, &YInc);
- Info->ptMaxSize.x = WorkArea.right - WorkArea.left + 2 * XInc;
- Info->ptMaxSize.y = WorkArea.bottom - WorkArea.top + 2 * YInc;
- Info->ptMaxTrackSize.x = Info->ptMaxSize.x;
- Info->ptMaxTrackSize.y = Info->ptMaxSize.y;
-
- if (Window->Wnd->InternalPosInitialized)
- {
- Info->ptMaxPosition = Window->Wnd->InternalPos.MaxPos;
- }
- else
- {
- Info->ptMaxPosition.x = WorkArea.left - XInc;
- Info->ptMaxPosition.y = WorkArea.top - YInc;
- }
+ INT xinc, yinc;
+ LONG style = Window->Wnd->style;
+ LONG adjustedStyle;
+ LONG exstyle = Window->Wnd->ExStyle;
+ RECT rc;
+
+ /* Compute default values */
+
+ rc = Window->Wnd->rcWindow;
+ Info->ptReserved.x = rc.left;
+ Info->ptReserved.y = rc.top;
+
+ if ((style & WS_CAPTION) == WS_CAPTION)
+ adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER
*/
+ else
+ adjustedStyle = style;
+
+ if(Window->Wnd->spwndParent)
+ IntGetClientRect(Window->spwndParent, &rc);
+ UserAdjustWindowRectEx(&rc, adjustedStyle, ((style & WS_POPUP) &&
Window->Wnd->IDMenu), exstyle);
+
+ xinc = -rc.left;
+ yinc = -rc.top;
+
+ Info->ptMaxSize.x = rc.right - rc.left;
+ Info->ptMaxSize.y = rc.bottom - rc.top;
+ if (style & (WS_DLGFRAME | WS_BORDER))
+ {
+ Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK);
+ Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK);
+ }
+ else
+ {
+ Info->ptMinTrackSize.x = 2 * xinc;
+ Info->ptMinTrackSize.y = 2 * yinc;
+ }
+ Info->ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK);
+ Info->ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK);
+ Info->ptMaxPosition.x = -xinc;
+ Info->ptMaxPosition.y = -yinc;
+
+ //if (!EMPTYPOINT(win->max_pos)) MinMax.ptMaxPosition = win->max_pos;
}
UINT FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/objects/rect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/rect.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/rect.c [iso-8859-1] Tue May 18 11:01:08
2010
@@ -102,5 +102,14 @@
}
}
+VOID
+FASTCALL
+RECTL_vInflateRect(RECTL *rect, INT dx, INT dy)
+{
+ rect->left -= dx;
+ rect->top -= dy;
+ rect->right += dx;
+ rect->bottom += dy;
+}
/* EOF */