Yet another attempt at fixing CW_USEDEFAULT handling.

This commit is contained in:
Alexandre Julliard 2000-06-08 01:01:09 +00:00
parent e3332128b0
commit 6aa2843fa9
1 changed files with 46 additions and 36 deletions

View File

@ -663,11 +663,17 @@ static void WIN_FixCoordinates( CREATESTRUCTA *cs, INT *sw)
{
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16 ||
cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
{
if (cs->style & (WS_CHILD | WS_POPUP))
{
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) cs->x = cs->y = 0;
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) cs->cx = cs->cy = 0;
}
else /* overlapped window */
{
STARTUPINFOA info;
int defcx = 0, defcy = 0;
info.dwFlags = 0;
if (!(cs->style & (WS_CHILD | WS_POPUP))) GetStartupInfoA( &info );
GetStartupInfoA( &info );
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
{
@ -692,17 +698,21 @@ static void WIN_FixCoordinates( CREATESTRUCTA *cs, INT *sw)
cs->y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
}
if (!(cs->style & (WS_CHILD | WS_POPUP)))
{ /* if no other hint from the app, pick 3/4 of the screen real estate */
RECT r;
SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0);
defcx = (((r.right - r.left) * 3) / 4) - cs->x;
defcy = (((r.bottom - r.top) * 3) / 4) - cs->y;
}
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
{
cs->cx = (info.dwFlags & STARTF_USESIZE) ? info.dwXSize : defcx;
cs->cy = (info.dwFlags & STARTF_USESIZE) ? info.dwYSize : defcy;
if (info.dwFlags & STARTF_USESIZE)
{
cs->cx = info.dwXSize;
cs->cy = info.dwYSize;
}
else /* if no other hint from the app, pick 3/4 of the screen real estate */
{
RECT r;
SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0);
cs->cx = (((r.right - r.left) * 3) / 4) - cs->x;
cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y;
}
}
}
}
}