diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 9ce20c3000..3ddaf9320b 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -228,15 +228,20 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): // Switch to OpenGL, which will save the new setting if successful wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL ); - auto handler = GetEventHandler(); - handler->ProcessEvent( evt ); + GetEventHandler()->ProcessEvent( evt ); + + // Switch back to Cairo if OpenGL is not supported + if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) + { + wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); + GetEventHandler()->ProcessEvent( cairoEvt ); + } } else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) { // If they were on legacy, switch them to Cairo wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); - auto handler = GetEventHandler(); - handler->ProcessEvent( evt ); + GetEventHandler()->ProcessEvent( evt ); } } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index b9f1edd4b0..5f9e930c55 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -484,15 +484,20 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // Switch to OpenGL, which will save the new setting if successful wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL ); - auto handler = GetEventHandler(); - handler->ProcessEvent( evt ); + GetEventHandler()->ProcessEvent( evt ); + + // Switch back to Cairo if OpenGL is not supported + if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) + { + wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); + GetEventHandler()->ProcessEvent( cairoEvt ); + } } else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) { // If they were on legacy, switch them to Cairo wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); - auto handler = GetEventHandler(); - handler->ProcessEvent( evt ); + GetEventHandler()->ProcessEvent( evt ); } }