diff --git a/gtk2_ardour/bundle_env_cocoa.cc b/gtk2_ardour/bundle_env_cocoa.cc index 68a7cd50d6..828212459e 100644 --- a/gtk2_ardour/bundle_env_cocoa.cc +++ b/gtk2_ardour/bundle_env_cocoa.cc @@ -54,7 +54,6 @@ using namespace std; extern void set_language_preference (); // cocoacarbon.mm extern void no_app_nap (); // cocoacarbon.mm -extern int query_darwin_version (); // cocoacarbon.mm static void setup_logging (void) @@ -99,13 +98,6 @@ fixup_bundle_environment (int argc, char* argv[], string & localedir) setup_logging (); } - if (query_darwin_version () >= 19) { - /* on Catalina, do not use NSGLView */ - g_setenv ("ARDOUR_NSGL", "0", 0); - } else { - g_setenv ("ARDOUR_NSGL", "1", 0); - } - no_app_nap (); if (!g_getenv ("ARDOUR_BUNDLED")) { diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 597dd8683c..06a2a4eacc 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3041,6 +3041,22 @@ These settings will only take effect after %1 is restarted.\n\ add_option (_("Appearance"), bgo); #endif +#ifdef __APPLE__ + ComboOption* glmode = new ComboOption ( + "use-opengl-view", + _("Render Canvas on openGL texture (requires restart)"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_opengl_view), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_opengl_view) + ); + glmode->add (NSGLAuto, _("until (including) macOS 10.14")); + glmode->add (NSGLDisable, _("No")); + glmode->add (NSGLEnable, _("Yes")); + + Gtkmm2ext::UI::instance()->set_tip (glmode->tip_widget(), string_compose ( + _("Render editor canvas, on a openGL texture, bypassing color-correction and retina scaling.\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); + add_option (_("Appearance"), glmode); +#endif + #if ENABLE_NLS add_option (_("Appearance/Translation"), new OptionEditorHeading (_("Internationalization"))); diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 203fec1eb4..01ce0dda8b 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -62,6 +62,8 @@ using namespace PBD; using namespace ARDOUR; using namespace Gtkmm2ext; +extern int query_darwin_version (); // cocoacarbon.mm + static const char* ui_config_file_name = "ui_config"; static const char* default_ui_config_file_name = "default_ui_config"; @@ -216,6 +218,24 @@ UIConfiguration::pre_gui_init () if (get_cairo_image_surface()) { g_setenv ("ARDOUR_IMAGE_SURFACE", "1", 1); } +#endif +#ifdef __APPLE__ + switch (get_use_opengl_view()) { + case NSGLAuto: + if (query_darwin_version () >= 19) { + /* on Catalina, do not use NSGLView */ + g_setenv ("ARDOUR_NSGL", "0", 0); + } else { + g_setenv ("ARDOUR_NSGL", "1", 0); + } + break; + case NSGLDisable: + g_setenv ("ARDOUR_NSGL", "0", 0); + break; + case NSGLEnable: + g_setenv ("ARDOUR_NSGL", "1", 0); + break; + } #endif return 0; } diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index d29f2079b7..f3de652ca2 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -107,6 +107,7 @@ UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.09339 UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false) UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false) +UI_CONFIG_VARIABLE (ARDOUR::AppleNSGLViewMode, use_opengl_view, "use-opengl-view", NSGLAuto) UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */ UI_CONFIG_VARIABLE (int32_t, recent_session_sort, "recent-session-sort", 0) UI_CONFIG_VARIABLE (bool, save_export_analysis_image, "save-export-analysis-image", false)