From d57ce0eba143840e8bbd13f0bb4209bb6e579e2c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 22 Mar 2024 13:12:50 -0600 Subject: [PATCH] provide control over use-cocoa-invalidation --- gtk2_ardour/ardour_ui_options.cc | 8 ++++++++ gtk2_ardour/cocoacarbon.mm | 7 +++++++ gtk2_ardour/rc_option_editor.cc | 12 ++++++++++++ gtk2_ardour/ui_config_vars.h | 1 + 4 files changed, 28 insertions(+) diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index d08b3a0fec..fcf6878166 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -50,6 +50,10 @@ #include "pbd/i18n.h" +#ifdef __APPLE__ +extern void use_cocoa_invalidation (int); // cocoacarbon.mm +#endif + using namespace Gtk; using namespace Gtkmm2ext; using namespace ARDOUR; @@ -501,6 +505,10 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "no-strobe") { stop_clocking (); start_clocking (); + } else if (p == "use-cocoa-invalidation") { +#ifdef __APPLE__ + use_cocoa_invalidation (UIConfiguration::instance().get_use_cocoa_invalidation()); +#endif } } diff --git a/gtk2_ardour/cocoacarbon.mm b/gtk2_ardour/cocoacarbon.mm index 5fdfd2118a..96bcf7de3a 100644 --- a/gtk2_ardour/cocoacarbon.mm +++ b/gtk2_ardour/cocoacarbon.mm @@ -201,3 +201,10 @@ query_darwin_version () } return -1; } + +void +use_cocoa_invalidation (int yn) +{ + gdk_quartz_set_use_cocoa_invalidation (yn); + std::cerr << "cocoa invalidation: " << yn << std::endl; +} diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index dde51bdbac..0385778c5c 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3096,6 +3096,18 @@ These settings will only take effect after %1 is restarted.\n\ add_option (_("Appearance/Quirks"), bo); #endif +#ifdef __APPLE__ + BoolOption* bco = new BoolOption ( + "use-cocoa-invalidation", + _("Use macOS to determine GUI redraw areas"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_cocoa_invalidation), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_cocoa_invalidation) + ); + + Gtkmm2ext::UI::instance()->set_tip (bco->tip_widget(), string_compose (_("When enabled, macOS is in charge of what areas of the GUI are redrawn.\nWhen disabled, %1 manages this by itself"), PROGRAM_NAME)); + add_option (_("Appearance/Quirks"), bco); +#endif + add_option (_("Appearance/Quirks"), new OptionEditorBlank ()); #if (!defined USE_CAIRO_IMAGE_SURFACE || defined CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE || defined __APPLE__) add_option (_("Appearance"), new OptionEditorHeading (_("Graphics Acceleration"))); diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 2df950a475..af35302df6 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -157,6 +157,7 @@ UI_CONFIG_VARIABLE (int, max_note_height, "max-note-height", 20) UI_CONFIG_VARIABLE (bool, prefer_tap_tempo, "prefer-tap-tempo", false) UI_CONFIG_VARIABLE (bool, sandbox_all_lua_scripts, "sandbox-all-lua-scripts", false) UI_CONFIG_VARIABLE (bool, update_action_scripts, "update-action-scripts", true) +UI_CONFIG_VARIABLE (bool, use_cocoa_invalidation, "use-cocoa-invalidation", false) /* these are visibility-type selections in the New Track dialog that we should make persistent for the user's choices */ UI_CONFIG_VARIABLE (bool, show_on_cue_page, "show-on-cue-page", true)