diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index 0b84755b4b..436c510804 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -36,7 +36,7 @@ #include "DlgEventLogListCtrl.h" #include "DlgEventLog.h" #include "AdvancedFrame.h" - +#include ////@begin includes @@ -166,10 +166,21 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt GetWindowDimensions( oTempPoint, oTempSize ); #ifdef __WXMSW__ - // Windows does some crazy things if the initial position is a negative - // value. - oTempPoint.x = wxDefaultCoord; - oTempPoint.y = wxDefaultCoord; + // Make sure that it fits within displayable area + wxDisplay *display = new wxDisplay(); + wxRect rDisplay = display->GetClientArea(); + if ( oTempSize.GetWidth() > rDisplay.width ) oTempSize.SetWidth(rDisplay.width); + if ( oTempSize.GetHeight() > rDisplay.height ) oTempSize.SetHeight(rDisplay.height); + + // 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 + oTempSize.GetWidth() > rDisplay.width ) { + oTempPoint.x = (rDisplay.width - oTempSize.GetWidth())/2; + } + if ( oTempPoint.y < 0 || oTempPoint.y + oTempSize.GetHeight() > rDisplay.height ) { + oTempPoint.y = (rDisplay.height - oTempSize.GetHeight())/2; + } + delete display; #endif #ifdef __WXMAC__