Disable Cairo canvas for Mac

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7052
This commit is contained in:
Jon Evans 2021-04-02 18:49:36 -04:00
parent 4551651777
commit fc8ffd8421
7 changed files with 23 additions and 1 deletions

View File

@ -1091,6 +1091,11 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
bool EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
{
#ifdef __WXMAC__
// Cairo is unsupported on Mac
if( aCanvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
aCanvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#endif
auto galCanvas = GetGalCanvas();
wxCHECK( galCanvas, false );
bool use_gal = galCanvas->SwitchBackend( aCanvasType );
@ -1120,6 +1125,12 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
#ifdef __WXMAC__
// Did Cairo get saved on Mac? Force OpenGL; Cairo doesn't work on Retina displays
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#endif
// 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

View File

@ -337,6 +337,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Language submenu
Pgm().AddMenuLanguageList( preferencesMenu );
#ifndef __WXMAC__
preferencesMenu->AppendSeparator();
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Libedit_Hotkeys_Descr,
@ -350,7 +351,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( preferencesMenu, ID_MENU_CANVAS_CAIRO, text,
_( "Use Modern Toolset with software graphics (fall-back)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#endif
// Menu Help:

View File

@ -638,6 +638,7 @@ static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu
// Language submenu
Pgm().AddMenuLanguageList( aParentMenu );
#ifndef __WXMAC__
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Eeschema_Hotkeys_Descr,
@ -651,6 +652,7 @@ static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu
AddMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, text,
_( "Use Modern Toolset with software graphics (fall-back)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#endif
aParentMenu->AppendSeparator();

View File

@ -139,8 +139,10 @@ void SCH_BASE_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
{
auto new_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#ifndef __WXMAC__
if( aEvent.GetId() == ID_MENU_CANVAS_CAIRO )
new_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
#endif
if( m_canvasType == new_type )
return;

View File

@ -323,10 +323,12 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
_( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#ifndef __WXMAC__
text = AddHotkeyName( _( "Modern Toolset (Fallba&ck)" ), GerbviewHotkeysDescr, HK_CANVAS_CAIRO );
AddMenuItem( configMenu, ID_MENU_CANVAS_CAIRO, text,
_( "Use Modern Toolset with software graphics (fall-back)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#endif
configMenu->AppendSeparator();

View File

@ -446,10 +446,12 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#ifndef __WXMAC__
text = AddHotkeyName( _( "Modern Toolset (&Fallback)" ), m_hotkeysDescrList, HK_CANVAS_CAIRO );
AddMenuItem( prefs_menu, ID_MENU_CANVAS_CAIRO, text,
_( "Use Modern Toolset with software graphics (fall-back)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#endif
prefs_menu->AppendSeparator();

View File

@ -173,11 +173,13 @@ void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
_( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#ifndef __WXMAC__
text = AddHotkeyName( _( "Modern Toolset (Fallbac&k)" ), g_Board_Editor_Hotkeys_Descr,
HK_CANVAS_CAIRO );
AddMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, text,
_( "Use Modern Toolset with software graphics (fall-back)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
#endif
aParentMenu->AppendSeparator();