From fc8ffd842183a7b1794eaac979eaf09484410fe6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 2 Apr 2021 18:49:36 -0400 Subject: [PATCH] Disable Cairo canvas for Mac Fixes https://gitlab.com/kicad/code/kicad/-/issues/7052 --- common/legacy_gal/eda_draw_frame.cpp | 11 +++++++++++ eeschema/libedit/menubar_libedit.cpp | 3 ++- eeschema/menubar.cpp | 2 ++ eeschema/sch_base_frame.cpp | 2 ++ gerbview/menubar.cpp | 2 ++ pcbnew/menubar_footprint_editor.cpp | 2 ++ pcbnew/menubar_pcb_editor.cpp | 2 ++ 7 files changed, 23 insertions(+), 1 deletion(-) diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index e4df328a7f..bd0ca26592 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -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 diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index 1a5fc2bf95..62e6fd596d 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -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: diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 080b3a7706..8226e3731c 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -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(); diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 6a7c315b70..0f579a8c5b 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -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; diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 7c4ade9a8a..bdeb0e1978 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -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(); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 9cf7cfe2a9..90199a381e 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -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(); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index a977e9e034..d03459d031 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -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();