Fix Design tab not painting on hardware GL after a page switch

request_repaint() only invalidates the canvas (Refresh()) on the hardware-GL
path and relies on a wxEVT_PAINT to follow. When the notebook re-shows the
Design page, that invalidation is issued mid-show and dropped: no paint event
arrives, the canvas never renders, and the pane stays blank until another tab
switch forces an expose. Software GL renders directly, so it never showed there.

force_repaint() defers past the show, then Refresh() + Update() for a
synchronous paint. Called from on_tab_shown().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-07-14 23:26:58 +02:00
co-authored by Claude Opus 4.8
parent 343a0439f1
commit 6d9368276c
3 changed files with 20 additions and 0 deletions
+14
View File
@@ -193,6 +193,20 @@ void DesignCanvas::request_repaint()
}
}
void DesignCanvas::force_repaint()
{
if (m_canvas == nullptr || m_canvas_widget == nullptr)
return;
CallAfter([this]() {
if (m_canvas == nullptr || m_canvas_widget == nullptr)
return;
m_canvas->set_as_dirty();
m_canvas_widget->Refresh();
m_canvas_widget->Update(); // synchronous: an expose may never come after a page show
});
}
void DesignCanvas::reload(bool keep_view)
{
m_canvas->reset_volumes();