From e635571f2f342f1c15843f4b1be07548c4c39d2f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 8 Oct 2022 17:48:53 +0200 Subject: [PATCH] Implement preference to destroy plugin UIs see also https://discourse.ardour.org/t/very-high-gpu-usage-on-windows/107672 --- gtk2_ardour/processor_box.cc | 21 +++++++++++++++++++++ gtk2_ardour/ui_config_vars.h | 1 + 2 files changed, 22 insertions(+) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 5ebed34abd..b58b975359 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -4674,6 +4674,27 @@ ProcessorWindowProxy::ProcessorWindowProxy (string const & name, ProcessorBox* b p->ToggleUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::show_the_right_window, this, false), gui_context()); p->ShowUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::show_the_right_window, this, true), gui_context()); p->HideUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::hide, this), gui_context()); + + boost::shared_ptr pi = boost::dynamic_pointer_cast (p); + if (pi) { + signal_unmap.connect (sigc::bind ([] (ProxyBase* self, PluginType type) { + ProcessorWindowProxy* me = dynamic_cast (self); + if (!me->is_custom) { + return; + } + switch (UIConfiguration::instance ().get_plugin_gui_behavior ()) { + case PluginGUIHide: + return; + case PluginGUIDestroyVST: + if (type != Windows_VST && type != LXVST && type != MacVST && type != VST3) { + return; + } + default: + break; + } + Glib::signal_idle ().connect (sigc::bind ([] (ProxyBase* s) { s->drop_window (); return false; }, self)); + }, this, pi->type ())); + } } ProcessorWindowProxy::~ProcessorWindowProxy() diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 401c5d9c9d..d58a87eeda 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -111,6 +111,7 @@ 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) UI_CONFIG_VARIABLE (bool, save_export_mixer_screenshot, "save-export-mixer-screenshot", false) UI_CONFIG_VARIABLE (bool, open_gui_after_adding_plugin, "open-gui-after-adding-plugin", true) +UI_CONFIG_VARIABLE (ARDOUR::PluginGUIBehavior, plugin_gui_behavior, "plugin-gui-behavior", PluginGUIHide) UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true) UI_CONFIG_VARIABLE (int32_t, max_plugin_chart, "max-plugin-chart", 10) UI_CONFIG_VARIABLE (int32_t, max_plugin_recent, "max-plugin-recent", 10)