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

@@ -1861,8 +1861,7 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
position.x = wxRound(position.x + rc.left);
position.y = wxRound(position.y + rc.top);
const int currentDisplay = wxDisplay::GetFromWindow(relativeWin);
const wxRect displayRect = wxDisplay(currentDisplay).GetClientArea();
const wxRect displayRect = wxDisplay(relativeWin).GetClientArea();
if (position.x < displayRect.GetLeft())
position.x = displayRect.GetLeft();