Make OpenGL default for all apps

Fixes https://gitlab.com/kicad/code/kicad/issues/9699
This commit is contained in:
Seth Hillbrand 2021-11-21 12:32:39 -08:00
parent bbafce6ab3
commit 3f2d86adec
7 changed files with 33 additions and 61 deletions

View File

@ -747,10 +747,9 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
// Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
// the user will be prompted to switch to OpenGL
// Legacy canvas no longer supported. Switch to OpenGL, falls back to Cairo on failure
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
return canvasType;
}
@ -763,7 +762,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
// a parent frame)
FRAME_T allowed_frames[] =
{
FRAME_SCH,
FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER,
FRAME_PL_EDITOR
@ -1106,38 +1105,17 @@ void EDA_DRAW_FRAME::resolveCanvasType()
{
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
{
wxString msg =
_( "KiCad can use your graphics card to give you a smoother "
"and faster experience. This option is turned off by "
"default since it is not compatible with all computers.\n\n"
"Would you like to try enabling graphics acceleration?\n\n"
"If you'd like to choose later, select Accelerated Graphics "
"in the Preferences menu." );
// Save Cairo as default in case OpenGL crashes
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
// Switch to OpenGL, which will save the new setting if successful
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
if( dlg.ShowModal() == wxID_YES )
{
// Save Cairo as default in case OpenGL crashes
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
// Switch to OpenGL, which will save the new setting if successful
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
// Switch back to Cairo if OpenGL is not supported
if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
HardRedraw();
}
else
{
// If they were on legacy, switch to Cairo
// Switch back to Cairo if OpenGL is not supported
if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
HardRedraw();
}
HardRedraw();
}
m_firstRunDialogSetting = 1;

View File

@ -286,13 +286,6 @@ void SCH_BASE_FRAME::createCanvas()
{
m_canvasType = loadCanvasTypeSetting();
// Allows only a CAIRO or OPENGL canvas:
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL
&& m_canvasType != EDA_DRAW_PANEL_GAL::GAL_FALLBACK )
{
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
}
SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType ) );
ActivateGalCanvas();

View File

@ -126,6 +126,19 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
LoadSettings( m_settings );
m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this );
// Preload libraries before using SyncLibraries the first time, as the preload is threaded
WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
m_libMgr->GetLibraryCount(), true );
m_libMgr->Preload( reporter );
SyncLibraries( false );
m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
resolveCanvasType();
SwitchCanvas( m_canvasType );
// Ensure axis are always drawn
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
gal_opts.m_axesEnabled = true;
@ -143,16 +156,6 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
setupTools();
setupUIConditions();
m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this );
// Preload libraries before using SyncLibraries the first time, as the preload is threaded
WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
m_libMgr->GetLibraryCount(), true );
m_libMgr->Preload( reporter );
SyncLibraries( false );
m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();

View File

@ -108,15 +108,13 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE()
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ),
m_show_layer_manager_tools( true )
{
m_showBorderAndTitleBlock = false; // true to show the frame references
m_canvasType = aBackend;
m_aboutTitle = _( "KiCad Footprint Editor" );
m_selLayerBox = nullptr;
m_editorSettings = nullptr;
@ -135,17 +133,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
SetIcons( icon_bundle );
// Create GAL canvas
if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN )
m_canvasType = loadCanvasTypeSetting();
else
m_canvasType = aBackend;
m_canvasType = loadCanvasTypeSetting();
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType );
SetCanvas( drawPanel );
SetBoard( new BOARD() );
// This board will only be used to hold a footprint for editing
GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER );
@ -191,6 +185,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
resolveCanvasType();
// LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
// parameters in m_LayersManager
// NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew

View File

@ -316,7 +316,7 @@ public:
protected:
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend );
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
/**
* Make sure the footprint info list is loaded (with a progress dialog) and then initialize

View File

@ -178,7 +178,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
fpPanel->Fit();
// Create GAL canvas
resolveCanvasType();
m_canvasType = loadCanvasTypeSetting();
SwitchCanvas( m_canvasType );
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType );
SetCanvas( drawPanel );

View File

@ -96,8 +96,7 @@ static struct IFACE : public KIFACE_BASE
}
case FRAME_FOOTPRINT_EDITOR:
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent,
EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN );
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
case FRAME_FOOTPRINT_VIEWER:
case FRAME_FOOTPRINT_VIEWER_MODAL: