Browse Source

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

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20385
revert-0c36e162
Mike Williams 7 months ago
parent
commit
a648fccbb3
  1. 9
      common/draw_panel_gal.cpp
  2. 5
      include/class_draw_panel_gal.h

9
common/draw_panel_gal.cpp

@ -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();
}
}

5
include/class_draw_panel_gal.h

@ -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;

Loading…
Cancel
Save