From 723127c4d417a15f32f0fd51b04bb34ba2eefeec Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 21 May 2013 15:30:11 -0500 Subject: [PATCH] Fix event log not being displayed on the same display as the manager --- clientgui/DlgEventLog.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index e1bc02ca36..f40760d957 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -167,7 +167,8 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt #ifdef __WXMSW__ // Get the current display space for the current window - int iDisplay = wxDisplay::GetFromWindow(parent); + int iDisplay = wxNOT_FOUND; + if ( wxGetApp().GetFrame() != NULL ) iDisplay = wxDisplay::GetFromWindow(wxGetApp().GetFrame()); if ( iDisplay == wxNOT_FOUND ) iDisplay = 0; wxDisplay *display = new wxDisplay(iDisplay); wxRect rDisplay = display->GetClientArea(); @@ -179,16 +180,16 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt // Check if part of the display was going to be off the screen, if so, center the // display on that axis - if ( oTempPoint.x < 0 ) { - oTempPoint.x = 0; - } else if ( oTempPoint.x + oTempSize.GetWidth() > rDisplay.width ) { - oTempPoint.x = rDisplay.width - oTempSize.GetWidth(); + if ( oTempPoint.x < rDisplay.x ) { + oTempPoint.x = rDisplay.x; + } else if ( oTempPoint.x + oTempSize.GetWidth() > rDisplay.x + rDisplay.width ) { + oTempPoint.x = rDisplay.x + rDisplay.width - oTempSize.GetWidth(); } - if ( oTempPoint.y < 0 ) { - oTempPoint.y = 0; - } else if ( oTempPoint.y + oTempSize.GetHeight() > rDisplay.height ) { - oTempPoint.y = rDisplay.height - oTempSize.GetHeight(); + if ( oTempPoint.y < rDisplay.y ) { + oTempPoint.y = rDisplay.y; + } else if ( oTempPoint.y + oTempSize.GetHeight() > rDisplay.y + rDisplay.height ) { + oTempPoint.y = rDisplay.y + rDisplay.height - oTempSize.GetHeight(); } delete display;