Don't manually centre dialogs created with default position in wxMSW.

We always centered the dialogs on the main display which was wrong if the
parent window was on another one. Instead of fixing it, simply don't centre
them at all and let Windows position them, there is no reason to change the
default behaviour.

Closes #13387.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-08-08 15:15:50 +00:00
parent 373a4816d4
commit 5d8d4b669a

View File

@ -439,25 +439,26 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
}
#endif // !__WXWINCE__
#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__)
// move the dialog to its initial position without forcing repainting
int x, y, w, h;
(void)MSWGetCreateWindowCoords(pos, size, x, y, w, h);
if ( x == (int)CW_USEDEFAULT )
{
// centre it on the screen - what else can we do?
wxSize sizeDpy = wxGetDisplaySize();
x = (sizeDpy.x - w) / 2;
y = (sizeDpy.y - h) / 2;
// Let the system position the window, just set its size.
::SetWindowPos(GetHwnd(), 0,
0, 0, w, h,
SWP_NOMOVE | SWP_NOZORDER);
}
#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__)
if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) )
else // Move the window to the desired location and set its size too.
{
wxLogLastError(wxT("MoveWindow"));
if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) )
{
wxLogLastError(wxT("MoveWindow"));
}
}
#endif
#endif // !__WXWINCE__
if ( !title.empty() )
{