From b743c39ed84732917c3812561cf24373fd3a1138 Mon Sep 17 00:00:00 2001 From: John Beard Date: Fri, 4 Jan 2019 14:00:05 +0000 Subject: [PATCH] On start without config, start pcbnew in Cairo GAL Currently, GAL is initialised to NONE (i.e. off). This causes issues when Legacy canvas is broken (i.e. GTK3). This changes the default to GAL Cairo, both in PCB_EDIT_FRAME init, and in the config load. Now, when the user starts with no config, they are prompted for a choice: OpenGL or Cairo, and one of them will be set up, with Cairo as fall back. Users on platforms that still support legacy can go to it as normal from the menu, but it will not be the default in any circumstance. Fixes: lp:1809997 * https://bugs.launchpad.net/kicad/+bug/1809997 --- common/legacy_gal/eda_draw_frame.cpp | 3 ++- common/legacy_wx/eda_draw_frame.cpp | 3 ++- pcbnew/pcb_edit_frame.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index 49b6637ad7..978d9c68e4 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -1085,10 +1085,11 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting() } // Coerce the value into a GAL type when Legacy is not available + // Default to Cairo, and on the first, user will be prompted for OpenGL if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() ) { - canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL; + canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; } return canvasType; diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index b34600e1d2..b315977096 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -1331,10 +1331,11 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting() } // Coerce the value into a GAL type when Legacy is not available + // Default to Cairo, and on the first, user will be prompted for OpenGL if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() ) { - canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL; + canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; } return canvasType; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index cb5344b2db..7d3b6c6afc 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -317,7 +317,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, GetGalDisplayOptions(), - EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ); + EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); SetGalCanvas( galCanvas ); @@ -425,9 +425,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : GetEventHandler()->ProcessEvent( cairoEvt ); } } - else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) + else { - // If they were on legacy, switch them to Cairo + // If they were on legacy, or they've been coerced into GAL + // due to unavailable legacy (GTK3), switch to Cairo wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); GetEventHandler()->ProcessEvent( evt ); }