From 8058937d596015890136b3d6af33e51d9c773ef5 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 22 Jan 2019 23:31:27 +1100 Subject: [PATCH] vst guis work on linux now --- effects/internal/vsthost.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index e6c3edfd1..9f8334dfb 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -9,11 +9,16 @@ #include #include #include +#include #include "playback/audio.h" #include "mainwindow.h" #include "debug.h" +#ifdef __linux__ +#include +#endif + #define BLOCK_SIZE 512 #define CHANNEL_COUNT 2 @@ -294,10 +299,21 @@ 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); } void VSTHost::uncheck_show_button() { + dispatcher(plugin, effEditClose, 0, 0, nullptr, 0); + show_interface_btn->setChecked(false); } @@ -307,11 +323,6 @@ void VSTHost::change_plugin() { if (plugin != nullptr) { if (configurePluginCallbacks()) { startPlugin(); -#ifdef _WIN32 - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#elif __APPLE__ - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#endif VSTRect* eRect = nullptr; plugin->dispatcher(plugin, effEditGetRect, 0, 0, &eRect, 0); dialog->setFixedWidth(eRect->right);