void MainEmuFrame::InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ) { conf.DisplaySize.Set( std::min( std::max( conf.DisplaySize.GetWidth(), 160 ), wxGetDisplayArea().GetWidth() ), std::min( std::max( conf.DisplaySize.GetHeight(), 160 ), wxGetDisplayArea().GetHeight() ) ); if( conf.AutoDock ) { conf.DisplayPosition = GetScreenPosition() + wxSize( GetSize().x, 0 ); } else if( conf.DisplayPosition != wxDefaultPosition ) { if( !wxGetDisplayArea().Contains( wxRect( conf.DisplayPosition, conf.DisplaySize ) ) ) conf.DisplayPosition = wxDefaultPosition; } }
void AppConfig::GSWindowOptions::SanityCheck() { // Ensure Conformation of various options... WindowSize.x = std::max( WindowSize.x, 8 ); WindowSize.x = std::min( WindowSize.x, wxGetDisplayArea().GetWidth()-16 ); WindowSize.y = std::max( WindowSize.y, 8 ); WindowSize.y = std::min( WindowSize.y, wxGetDisplayArea().GetHeight()-48 ); // Make sure the upper left corner of the window is visible enought o grab and // move into view: if( !wxGetDisplayArea().Contains( wxRect( WindowPos, wxSize( 48,48 ) ) ) ) WindowPos = wxDefaultPosition; if( (uint)AspectRatio >= (uint)AspectRatio_MaxCount ) AspectRatio = AspectRatio_4_3; }
// Returns FALSE if the window position is considered invalid, which means that it's title // bar is most likely not easily grabble. Such a window should be moved to a valid or // default position. bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos ) { // The height of the window is only revlevant to the height of a title bar, which is // all we need visible for the user to be able to drag the window into view. But // there's no way to get that info from wx, so we'll just have to guesstimate... wxSize sizeMatters( window.GetSize().GetWidth(), 32 ); // if some gui has 32 pixels of undraggable title bar, the user deserves to suffer. return wxGetDisplayArea().Contains( wxRect( windowPos, sizeMatters ) ); }