From 637c2414ed45b7c70a77a8a627e3a0f3042b55ba Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 22 Jan 2019 23:41:22 +1100 Subject: [PATCH] better linux vst ui support --- effects/internal/vsthost.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index 9f8334dfb..bdd007ecd 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -299,21 +299,22 @@ void VSTHost::save(QXmlStreamWriter &stream) { } void VSTHost::show_interface(bool show) { -#if defined(_WIN32) - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#elif defined(__APPLE__) - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#elif defined(__linux__) - Window xwindow = dialog->windowHandle()->winId(); - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(xwindow), 0); -#endif + dialog->setVisible(show); - dialog->setVisible(show); + if (show) { +#if defined(_WIN32) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#elif defined(__APPLE__) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#elif defined(__linux__) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#endif + } else { + dispatcher(plugin, effEditClose, 0, 0, nullptr, 0); + } } void VSTHost::uncheck_show_button() { - dispatcher(plugin, effEditClose, 0, 0, nullptr, 0); - show_interface_btn->setChecked(false); }