13
0

Expose preference to use NSGLView on macOS

This commit is contained in:
Robin Gareus 2023-01-20 21:54:11 +01:00
parent e6230bfd98
commit 54c765ad2a
4 changed files with 37 additions and 8 deletions

View File

@ -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")) {

View File

@ -3041,6 +3041,22 @@ These settings will only take effect after %1 is restarted.\n\
add_option (_("Appearance"), bgo);
#endif
#ifdef __APPLE__
ComboOption<AppleNSGLViewMode>* glmode = new ComboOption<AppleNSGLViewMode> (
"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")));

View File

@ -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;
}

View File

@ -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)