Yet another attempt at fixing CW_USEDEFAULT handling.
This commit is contained in:
parent
e3332128b0
commit
6aa2843fa9
@ -663,11 +663,17 @@ static void WIN_FixCoordinates( CREATESTRUCTA *cs, INT *sw)
|
|||||||
{
|
{
|
||||||
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16 ||
|
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16 ||
|
||||||
cs->cx == CW_USEDEFAULT || cs->cx == 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;
|
STARTUPINFOA info;
|
||||||
int defcx = 0, defcy = 0;
|
|
||||||
info.dwFlags = 0;
|
GetStartupInfoA( &info );
|
||||||
if (!(cs->style & (WS_CHILD | WS_POPUP))) GetStartupInfoA( &info );
|
|
||||||
|
|
||||||
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
|
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;
|
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)
|
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
|
||||||
{
|
{
|
||||||
cs->cx = (info.dwFlags & STARTF_USESIZE) ? info.dwXSize : defcx;
|
if (info.dwFlags & STARTF_USESIZE)
|
||||||
cs->cy = (info.dwFlags & STARTF_USESIZE) ? info.dwYSize : defcy;
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user