[COMCTL32] Fix recalculation of property-sheet dialog position (#1818)

During initialization of property sheet dialogs, their overall size can change (when adding property sheets) after the dialog has been created and pre-positioned by win32k.
Therefore their position needs to be recomputed so that they try to fit the best on screen.

CORE-9008, CORE-9602
This commit is contained in:
Jose Carlos Jesus 2020-05-15 17:12:02 +01:00 committed by GitHub
parent ffd0ab39b5
commit 2bd6bfdd90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3580,6 +3580,30 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
SetFocus(GetDlgItem(hwnd, IDOK));
}
#ifdef __REACTOS__
{ /*
try to fit it into the desktop
user32 positions the dialog based on the IDD_PROPSHEET template,
but we've since made it larger by adding controls
*/
RECT rcWork;
RECT rcDlg;
int dx, dy;
if (GetWindowRect(hwnd, &rcDlg) && SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0))
{
dx = rcDlg.right - rcWork.right;
dy = rcDlg.bottom - rcWork.bottom;
if (rcDlg.right > rcWork.right)
rcDlg.left -= dx;
if (rcDlg.bottom > rcWork.bottom)
rcDlg.top -= dy;
SetWindowPos(hwnd, HWND_TOPMOST, rcDlg.left, rcDlg.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOSIZE);
}
}
#endif
if (IS_INTRESOURCE(psInfo->ppshheader.pszCaption) &&
psInfo->ppshheader.hInstance)