Fix assert that fires sometimes when closing windows on mac

This commit is contained in:
Jon Evans 2021-06-18 18:15:00 -04:00
parent 96e4b19444
commit 5a832fc337
1 changed files with 3 additions and 3 deletions

View File

@ -510,7 +510,7 @@ void EDA_BASE_FRAME::OnSize( wxSizeEvent& aEvent )
#ifdef __WXMAC__ #ifdef __WXMAC__
int currentDisplay = wxDisplay::GetFromWindow( this ); int currentDisplay = wxDisplay::GetFromWindow( this );
if( m_displayIndex >= 0 && currentDisplay != m_displayIndex ) if( m_displayIndex >= 0 && currentDisplay >= 0 && currentDisplay != m_displayIndex )
{ {
wxLogTrace( traceDisplayLocation, "OnSize: current display changed %d to %d", wxLogTrace( traceDisplayLocation, "OnSize: current display changed %d to %d",
m_displayIndex, currentDisplay ); m_displayIndex, currentDisplay );
@ -659,7 +659,7 @@ void EDA_BASE_FRAME::ensureWindowIsOnScreen()
if( pos.x + size.x - clientSize.x > clientSize.width ) if( pos.x + size.x - clientSize.x > clientSize.width )
{ {
int newWidth = clientSize.width - pos.x; int newWidth = clientSize.width - ( pos.x - clientSize.x );
wxLogTrace( traceDisplayLocation, wxLogTrace( traceDisplayLocation,
"ensureWindowIsOnScreen: effective width %d above available %d, setting to %d", "ensureWindowIsOnScreen: effective width %d above available %d, setting to %d",
pos.x + size.x, clientSize.width, newWidth ); pos.x + size.x, clientSize.width, newWidth );
@ -668,7 +668,7 @@ void EDA_BASE_FRAME::ensureWindowIsOnScreen()
if( pos.y + size.y - clientSize.y > clientSize.height ) if( pos.y + size.y - clientSize.y > clientSize.height )
{ {
int newHeight = clientSize.height - pos.y; int newHeight = clientSize.height - ( pos.y - clientSize.y );
wxLogTrace( traceDisplayLocation, wxLogTrace( traceDisplayLocation,
"ensureWindowIsOnScreen: effective height %d above available %d, setting to %d", "ensureWindowIsOnScreen: effective height %d above available %d, setting to %d",
pos.y + size.y, clientSize.height, newHeight ); pos.y + size.y, clientSize.height, newHeight );