From cff76e55d52eb1a29e7f990ba86a858a5f2e59e9 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Mon, 17 Aug 2020 12:37:25 +0100 Subject: [PATCH] Only update the layer icon bitmap when it has actually changed This was causing unnecessary calls to refresh the toolbar, causing flickering in the layer widget. Fixes https://gitlab.com/kicad/code/kicad/-/issues/5212 --- pcbnew/toolbars_pcb_editor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 27396c49f2..e7a85bb6c2 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -200,12 +200,12 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) wxIMAGE_QUALITY_NEAREST ); LayerPairBitmap = std::make_unique( image ); - } - if( m_mainToolBar ) - { - m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap ); - m_mainToolBar->Refresh(); + if( m_mainToolBar ) + { + m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap ); + m_mainToolBar->Refresh(); + } } } @@ -662,5 +662,6 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ) { - m_SelLayerBox->SetLayerSelection( GetActiveLayer() ); + if( m_SelLayerBox->GetLayerSelection() != GetActiveLayer() ) + m_SelLayerBox->SetLayerSelection( GetActiveLayer() ); }