From e39586e1572ca001b0de4c761b32a4db8b4efb9a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 10 Dec 2019 07:47:13 -0800 Subject: [PATCH] Eeschema: Catch error on init Some windows systems will not fall back correctly on our standard initialization step, so we need the additional std:: error fall back to catch them. Fixes #2620 | https://gitlab.com/kicad/code/kicad/issues/2620 --- eeschema/sch_draw_panel.cpp | 52 +++++++++++++++++++++++++++++-------- eeschema/sch_draw_panel.h | 3 +++ 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp index 83c9a6cdf1..ce987d6aa4 100644 --- a/eeschema/sch_draw_panel.cpp +++ b/eeschema/sch_draw_panel.cpp @@ -24,19 +24,28 @@ */ -#include -#include #include -#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include -#include -#include -#include -#include -#include -#include -#include -#include SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId, @@ -167,6 +176,27 @@ KIGFX::SCH_VIEW* SCH_DRAW_PANEL::GetView() const } +void SCH_DRAW_PANEL::OnShow() +{ + SCH_BASE_FRAME* frame = dynamic_cast( GetParent() ); + + try + { + // Check if the current rendering backend can be properly initialized + m_view->UpdateItems(); + } + catch( const std::runtime_error& e ) + { + // Fallback to software renderer + DisplayInfoMessage( frame, e.what() ); + SwitchBackend( GAL_TYPE_CAIRO ); + + if( frame ) + frame->ActivateGalCanvas(); + } +} + + void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent ) { // The first wxPaintEvent can be fired at startup before the GAL engine is fully initialized diff --git a/eeschema/sch_draw_panel.h b/eeschema/sch_draw_panel.h index b4fb00893f..e5a993870d 100644 --- a/eeschema/sch_draw_panel.h +++ b/eeschema/sch_draw_panel.h @@ -54,6 +54,9 @@ public: protected: virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override; + ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() + void OnShow() override; + void setDefaultLayerOrder(); ///> Reassigns layer order to the initial settings. void setDefaultLayerDeps(); ///> Sets rendering targets & dependencies for layers.