Remove canvas-switching from OSX.
The Cairo renderer doesn't work on Retina displays. Fixes https://gitlab.com/kicad/code/kicad/issues/4788
This commit is contained in:
parent
452171e055
commit
2697fc3864
|
@ -233,13 +233,19 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
|||
}
|
||||
catch( std::runtime_error& err )
|
||||
{
|
||||
constexpr auto GAL_FALLBACK = GAL_TYPE_CAIRO;
|
||||
if( GAL_FALLBACK != m_backend )
|
||||
{
|
||||
SwitchBackend( GAL_FALLBACK );
|
||||
|
||||
SwitchBackend( GAL_FALLBACK );
|
||||
|
||||
DisplayInfoMessage( m_parent,
|
||||
_( "Could not use OpenGL, falling back to software rendering" ),
|
||||
wxString( err.what() ) );
|
||||
DisplayInfoMessage( m_parent,
|
||||
_( "Could not use OpenGL, falling back to software rendering" ),
|
||||
wxString( err.what() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're well and truly banjaxed if we get here without a fallback.
|
||||
DisplayInfoMessage( m_parent, _( "Could not use OpenGL" ), wxString( err.what() ) );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PROFILE
|
||||
|
@ -398,10 +404,19 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
|||
}
|
||||
else
|
||||
{
|
||||
aGalType = GAL_TYPE_CAIRO;
|
||||
DisplayInfoMessage( m_parent,
|
||||
_( "Could not use OpenGL, falling back to software rendering" ), errormsg );
|
||||
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
|
||||
if( GAL_FALLBACK != aGalType )
|
||||
{
|
||||
aGalType = GAL_FALLBACK;
|
||||
DisplayInfoMessage( m_parent,
|
||||
_( "Could not use OpenGL, falling back to software rendering" ),
|
||||
errormsg );
|
||||
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're well and truly banjaxed if we get here without a fallback.
|
||||
DisplayInfoMessage( m_parent, _( "Could not use OpenGL" ), errormsg );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <title_block.h>
|
||||
#include <tool/action_manager.h>
|
||||
#include <tool/actions.h>
|
||||
#include <tool/common_tools.h>
|
||||
#include <tool/grid_menu.h>
|
||||
|
@ -651,6 +650,12 @@ void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
|||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays so there's really only one game
|
||||
// in town for Mac
|
||||
return EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#endif
|
||||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
|
||||
|
||||
|
@ -667,14 +672,7 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
|
|||
// Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
|
||||
// the user will be prompted to switch to OpenGL
|
||||
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#else
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
}
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
|
||||
|
||||
return canvasType;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
|||
{
|
||||
// Make Coverity happy:
|
||||
m_LibTree.column_width = 360;
|
||||
m_Graphics.canvas_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
m_Graphics.canvas_type = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
|
||||
|
||||
// Build parameters list:
|
||||
m_params.emplace_back( new PARAM<int>( "find_replace.flags", &m_FindReplace.flags, 1 ) );
|
||||
|
@ -62,14 +62,8 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
|||
m_params.emplace_back( new PARAM_LIST<wxString>( "find_replace.replace_history",
|
||||
&m_FindReplace.replace_history, {} ) );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays so default to OpenGL
|
||||
m_params.emplace_back( new PARAM<int>( "graphics.canvas_type",
|
||||
&m_Graphics.canvas_type, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) );
|
||||
#else
|
||||
m_params.emplace_back( new PARAM<int>( "graphics.canvas_type",
|
||||
&m_Graphics.canvas_type, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
#endif
|
||||
&m_Graphics.canvas_type, EDA_DRAW_PANEL_GAL::GAL_FALLBACK ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<float>(
|
||||
"graphics.highlight_factor", &m_Graphics.highlight_factor, 0.5f, 0.0, 1.0f ) );
|
||||
|
|
|
@ -555,22 +555,14 @@ TOOL_ACTION ACTIONS::updateSchematicFromPcb( "common.Control.updateSchematicFrom
|
|||
|
||||
TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics",
|
||||
AS_GLOBAL,
|
||||
#ifdef __WXMAC__
|
||||
MD_ALT + WXK_F11,
|
||||
#else
|
||||
WXK_F11,
|
||||
#endif
|
||||
LEGACY_HK_NAME( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
|
||||
_( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ),
|
||||
tools_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::standardGraphics( "common.Control.standardGraphics",
|
||||
AS_GLOBAL,
|
||||
#ifdef __WXMAC__
|
||||
MD_ALT + WXK_F12,
|
||||
#else
|
||||
WXK_F12,
|
||||
#endif
|
||||
LEGACY_HK_NAME( "Switch to Modern Toolset with software graphics (fall-back)" ),
|
||||
_( "Standard Graphics" ), _( "Use software graphics (fall-back)" ),
|
||||
tools_xpm );
|
||||
|
|
|
@ -522,8 +522,10 @@ int COMMON_TOOLS::SwitchCanvas( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
|
||||
m_frame->SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
||||
#ifndef __WXMAC__
|
||||
else if( aEvent.IsAction( &ACTIONS::standardGraphics ) )
|
||||
m_frame->SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
#endif
|
||||
else
|
||||
wxFAIL_MSG( "Unknown canvas type" );
|
||||
|
||||
|
|
|
@ -78,14 +78,9 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
|||
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
||||
|
||||
// Create GAL canvas before loading settings
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#else
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(), backend );
|
||||
GetGalDisplayOptions(),
|
||||
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
|
||||
SetCanvas( gal_drawPanel );
|
||||
|
||||
// Don't show the default board solder mask clearance. Only the
|
||||
|
|
|
@ -160,9 +160,11 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, selTool );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
prefsMenu->AppendSeparator();
|
||||
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||
#endif
|
||||
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
|
|
|
@ -268,9 +268,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, selTool );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
prefsMenu->AppendSeparator();
|
||||
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||
#endif
|
||||
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
|
|
|
@ -304,7 +304,7 @@ void SCH_BASE_FRAME::createCanvas()
|
|||
|
||||
// Allows only a CAIRO or OPENGL canvas:
|
||||
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL
|
||||
&& m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
|
||||
&& m_canvasType != EDA_DRAW_PANEL_GAL::GAL_FALLBACK )
|
||||
{
|
||||
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
}
|
||||
|
|
|
@ -192,12 +192,16 @@ void SCH_DRAW_PANEL::OnShow()
|
|||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
// Fallback to software renderer
|
||||
DisplayInfoMessage( frame, e.what() );
|
||||
SwitchBackend( GAL_TYPE_CAIRO );
|
||||
|
||||
if( frame )
|
||||
frame->ActivateGalCanvas();
|
||||
// Use fallback if one is available
|
||||
if( GAL_FALLBACK != m_backend )
|
||||
{
|
||||
SwitchBackend( GAL_FALLBACK );
|
||||
|
||||
if( frame )
|
||||
frame->ActivateGalCanvas();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,11 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
|
|||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = aCanvasType;
|
||||
|
||||
// Allows only a CAIRO or OPENGL canvas:
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL &&
|
||||
canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL
|
||||
&& canvasType != EDA_DRAW_PANEL_GAL::GAL_FALLBACK )
|
||||
{
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
}
|
||||
|
||||
m_preview = new SCH_PREVIEW_PANEL( aParent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
|
||||
m_galDisplayOptions, canvasType );
|
||||
|
|
|
@ -239,9 +239,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
preferencesMenu->AppendSeparator();
|
||||
AddMenuLanguageList( preferencesMenu, selTool );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
preferencesMenu->AppendSeparator();
|
||||
preferencesMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||
preferencesMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||
#endif
|
||||
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
|
|
|
@ -63,6 +63,13 @@ public:
|
|||
GAL_TYPE_LAST ///< Sentinel, do not use as a parameter
|
||||
};
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Cairo doesn't work on OSX so we really have no fallback available.
|
||||
static constexpr GAL_TYPE GAL_FALLBACK = GAL_TYPE_OPENGL;
|
||||
#else
|
||||
static constexpr GAL_TYPE GAL_FALLBACK = GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a drawing panel that is contained inside \p aParentWindow.
|
||||
*
|
||||
|
|
|
@ -96,12 +96,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
SetIcon( icon );
|
||||
|
||||
// Create GAL canvas
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays
|
||||
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#else
|
||||
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
|
||||
|
||||
auto* drawPanel = new PL_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(), m_canvasType );
|
||||
|
|
|
@ -255,14 +255,10 @@ void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
|
|||
void DIALOG_PAD_PROPERTIES::prepareCanvas()
|
||||
{
|
||||
// Initialize the canvas to display the pad
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#else
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition, wxDefaultSize,
|
||||
m_parent->GetGalDisplayOptions(), backend );
|
||||
m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
m_parent->GetGalDisplayOptions(),
|
||||
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
|
||||
|
||||
m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
|
|
@ -126,14 +126,10 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
|
||||
|
||||
// Create GAL canvas
|
||||
#ifdef __WXMAC__
|
||||
// Cairo renderer doesn't handle Retina displays
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
#else
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
#endif
|
||||
PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(), backend );
|
||||
PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
|
||||
m_FrameSize,
|
||||
GetGalDisplayOptions(),
|
||||
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
|
||||
SetCanvas( gal_drawPanel );
|
||||
|
||||
PCB_DISPLAY_OPTIONS disp_opts = GetDisplayOptions();
|
||||
|
|
|
@ -235,9 +235,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, selTool );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
prefsMenu->AppendSeparator();
|
||||
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||
#endif
|
||||
|
||||
//--MenuBar -----------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -445,9 +445,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, selTool );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
prefsMenu->AppendSeparator();
|
||||
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||
#endif
|
||||
|
||||
|
||||
//--MenuBar -----------------------------------------------------------
|
||||
|
|
|
@ -424,12 +424,16 @@ void PCB_DRAW_PANEL_GAL::OnShow()
|
|||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
// Fallback to software renderer
|
||||
DisplayError( GetParent(), e.what() );
|
||||
SwitchBackend( GAL_TYPE_CAIRO );
|
||||
|
||||
if( frame )
|
||||
frame->ActivateGalCanvas();
|
||||
// Use the fallback if we have one
|
||||
if( GAL_FALLBACK != m_backend )
|
||||
{
|
||||
SwitchBackend( GAL_FALLBACK );
|
||||
|
||||
if( frame )
|
||||
frame->ActivateGalCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
if( frame )
|
||||
|
|
|
@ -195,7 +195,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Create GAL canvas
|
||||
auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(),
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
|
||||
|
||||
SetCanvas( canvas );
|
||||
|
||||
|
|
Loading…
Reference in New Issue