7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 05:26:55 +00:00

schematic editor: remove 10ms OnShow timer to reduce CPU load

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20385
This commit is contained in:
Mike Williams 2025-03-19 15:05:15 -04:00
parent 19d1b6ec52
commit a648fccbb3
2 changed files with 3 additions and 11 deletions

View File

@ -160,11 +160,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect( m_refreshTimer.GetId(), wxEVT_TIMER,
wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), nullptr, this );
// Set up timer to execute OnShow() method when the window appears on the screen
m_onShowTimer.SetOwner( this );
Connect( m_onShowTimer.GetId(), wxEVT_TIMER,
wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onShowTimer ), nullptr, this );
m_onShowTimer.Start( 10 );
Connect( wxEVT_SHOW, wxShowEventHandler( EDA_DRAW_PANEL_GAL::onShowEvent ), nullptr, this );
}
@ -650,11 +646,10 @@ void EDA_DRAW_PANEL_GAL::onRefreshTimer( wxTimerEvent& aEvent )
}
void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
void EDA_DRAW_PANEL_GAL::onShowEvent( wxShowEvent& aEvent )
{
if( m_gal && m_gal->IsInitialized() && m_gal->IsVisible() )
{
m_onShowTimer.Stop();
OnShow();
}
}

View File

@ -268,7 +268,7 @@ protected:
void onLostFocus( wxFocusEvent& aEvent );
void onIdle( wxIdleEvent& aEvent );
void onRefreshTimer( wxTimerEvent& aEvent );
void onShowTimer( wxTimerEvent& aEvent );
void onShowEvent( wxShowEvent& aEvent );
wxWindow* m_parent; ///< Pointer to the parent window
EDA_DRAW_FRAME* m_edaFrame; ///< Parent EDA_DRAW_FRAME (if available)
@ -288,9 +288,6 @@ protected:
/// True when canvas needs to be refreshed from idle handler
bool m_needIdleRefresh;
/// Timer used to execute OnShow() when the window finally appears on the screen.
wxTimer m_onShowTimer;
/// Interface for drawing objects on a 2D-surface
KIGFX::GAL* m_gal;