Use the new wxDisplay(wxWindow*) ctor to simplify the code

Make the code simpler and, in a couple of places where the fall back to
the primary display in case wxDisplay::GetFromWindow() returned -1 was
missing, also more correct.
This commit is contained in:
Vadim Zeitlin
2018-11-01 00:06:34 +01:00
parent f57cb6c1d9
commit 4ad9cde380
7 changed files with 10 additions and 30 deletions

View File

@@ -930,15 +930,9 @@ wxSize wxSizer::ComputeFittingClientSize(wxWindow *window)
return tlw->GetClientSize();
}
// limit the window to the size of the display it is on
int disp = wxDisplay::GetFromWindow(window);
if ( disp == wxNOT_FOUND )
{
// or, if we don't know which one it is, of the main one
disp = 0;
}
sizeMax = wxDisplay(disp).GetClientArea().GetSize();
// limit the window to the size of the display it is on (or the main
// one if the window display can't be determined)
sizeMax = wxDisplay(window).GetClientArea().GetSize();
// If determining the display size failed, skip the max size checks as
// we really don't want to create windows of (0, 0) size.