Keep track of LV2 externalUI visibility

This allows Ardour to re-open previously shown plugins,
and toggle externalUI.

This worked in the distant past, before Ardour 3.3 introduced
the Ardour Window Manager.
This commit is contained in:
Robin Gareus 2023-11-26 19:37:37 +01:00
parent 73b44532f1
commit 3355e753bf
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 48 additions and 3 deletions

View File

@ -250,7 +250,7 @@ LV2PluginUI::queue_port_update()
void
LV2PluginUI::output_update()
{
//cout << "output_update" << endl;
//std::cout << "output_update" << std::endl;
if (_external_ui_ptr) {
LV2_EXTERNAL_UI_RUN(_external_ui_ptr);
if (_lv2->is_external_kx() && !_external_ui_ptr) {
@ -590,7 +590,7 @@ LV2PluginUI::is_update_wanted(uint32_t /*index*/)
bool
LV2PluginUI::on_window_show(const std::string& title)
{
//cout << "on_window_show - " << title << endl; flush(cout);
//std::cout << "on_window_show - " << title << std::endl;// flush(cout);
if (_lv2->is_external_ui()) {
if (_external_ui_ptr) {
@ -645,3 +645,15 @@ LV2PluginUI::on_window_hide()
lv2ui_free();
}
}
bool
LV2PluginUI::is_external () const
{
return _lv2->is_external_ui ();
}
bool
LV2PluginUI::is_external_visible () const
{
return _external_ui_ptr != 0;
}

View File

@ -66,6 +66,9 @@ public:
bool start_updating(GdkEventAny*);
bool stop_updating(GdkEventAny*);
bool is_external () const;
bool is_external_visible () const;
int package (Gtk::Window&);
void grab_focus ();

View File

@ -100,6 +100,9 @@ public:
virtual bool start_updating(GdkEventAny*) = 0;
virtual bool stop_updating(GdkEventAny*) = 0;
virtual bool is_external () const { return false; }
virtual bool is_external_visible () const { return false; }
virtual void activate () {}
virtual void deactivate () {}

View File

@ -4787,12 +4787,36 @@ ProcessorWindowProxy::session_handle()
/* we don't care */
return 0;
}
bool
ProcessorWindowProxy::visible () const
{
PluginUIWindow* puiw = dynamic_cast<PluginUIWindow*> (_window);
if (puiw && puiw->pluginui().is_external ()) {
return puiw->pluginui().is_external_visible ();
}
return WM::ProxyBase::visible ();
}
bool
ProcessorWindowProxy::fully_visible () const
{
PluginUIWindow* puiw = dynamic_cast<PluginUIWindow*> (_window);
if (puiw && puiw->pluginui().is_external ()) {
return puiw->pluginui().is_external_visible ();
}
return WM::ProxyBase::fully_visible ();
}
XMLNode&
ProcessorWindowProxy::get_state () const
{
PluginUIWindow* puiw = dynamic_cast<PluginUIWindow*> (_window);
XMLNode *node;
node = &ProxyBase::get_state();
if (puiw && puiw->pluginui().is_external ()) {
node->set_property (X_("visible"), puiw->pluginui().is_external_visible ());
}
node->set_property (X_("custom-ui"), is_custom);
return *node;
}
@ -4844,7 +4868,7 @@ ProcessorWindowProxy::get (bool create)
if (_window) {
setup ();
_window->show_all ();
_window->show_all (); // XXX
}
}
return _window;

View File

@ -105,6 +105,9 @@ public:
int set_state (const XMLNode&, int);
XMLNode& get_state () const;
bool visible() const;
bool fully_visible() const;
private:
ProcessorBox* _processor_box;
std::weak_ptr<ARDOUR::Processor> _processor;