From 02f31c8de1ebacf79cf3cf336be32c86597be014 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 4 Mar 2026 08:08:58 -0800 Subject: [PATCH] Fix empty symbol chooser previews on first load Add an aAllowSkip parameter to DoRePaint that gates both skip checks. onPaint and ForceRefresh pass false so they always execute the full GL/Cairo cycle. The rate-limited Refresh path continues to pass true (the default), preserving the GPU utilization improvement from b728c08b7a. Fixes https://gitlab.com/kicad/code/kicad/-/issues/23325 --- common/draw_panel_gal.cpp | 12 +++++++----- include/class_draw_panel_gal.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 6304e5607c..b61506c409 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -193,11 +193,11 @@ void EDA_DRAW_PANEL_GAL::SetFocus() void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) { - Refresh( false ); + DoRePaint( false ); } -bool EDA_DRAW_PANEL_GAL::DoRePaint() +bool EDA_DRAW_PANEL_GAL::DoRePaint( bool aAllowSkip ) { if( !m_refreshMutex.try_lock() ) return false; @@ -254,7 +254,9 @@ bool EDA_DRAW_PANEL_GAL::DoRePaint() bool hasPendingItemUpdates = m_view->HasPendingItemUpdates(); // Skip all update work when nothing has changed since the previous frame. - if( !viewDirty && !cursorMoved && !hasPendingItemUpdates ) + // Never skip when responding to a native paint event or explicit ForceRefresh + // because the window content may have been invalidated by the OS. + if( aAllowSkip && !viewDirty && !cursorMoved && !hasPendingItemUpdates ) { m_lastRepaintEnd = wxGetLocalTimeMillis(); return true; @@ -290,7 +292,7 @@ bool EDA_DRAW_PANEL_GAL::DoRePaint() // After processing item updates, skip the GL cycle when neither the // view targets nor the cursor position have changed. - if( !viewDirty && !cursorMoved ) + if( aAllowSkip && !viewDirty && !cursorMoved ) { m_lastRepaintEnd = wxGetLocalTimeMillis(); return true; @@ -478,7 +480,7 @@ void EDA_DRAW_PANEL_GAL::ForceRefresh() } } - DoRePaint(); + DoRePaint( false ); } diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index d2f582f94f..d88a099f00 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -233,7 +233,7 @@ public: * * @return true if the repaint attempt was successful. */ - bool DoRePaint(); + bool DoRePaint( bool aAllowSkip = true ); /** * Create an overlay for rendering debug graphics.