From daddaffccf0ef7bbb6cfc2268aa8d9e6aec59cc3 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 5 Sep 2025 22:51:47 +0200 Subject: [PATCH] Check for "modern" app type when creating plugin UI Signed-off-by: falkTX --- distrho/src/DistrhoUIInternal.hpp | 3 ++- distrho/src/DistrhoUILV2.cpp | 8 ++++++-- distrho/src/DistrhoUIPrivateData.hpp | 10 +++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index ea3f56a2..3e6ebde8 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -47,11 +47,12 @@ public: const char* const bundlePath = nullptr, void* const dspPtr = nullptr, const double scaleFactor = 0.0, + const bool isModern = false, const uint32_t bgColor = 0, const uint32_t fgColor = 0xffffffff, const char* const appClassName = nullptr) : ui(nullptr), - uiData(new UI::PrivateData(appClassName)) + uiData(new UI::PrivateData(appClassName, isModern)) { uiData->sampleRate = sampleRate; uiData->bundlePath = bundlePath != nullptr ? strdup(bundlePath) : nullptr; diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp index d7b0af65..6195b069 100644 --- a/distrho/src/DistrhoUILV2.cpp +++ b/distrho/src/DistrhoUILV2.cpp @@ -80,6 +80,7 @@ public: void* const dspPtr, const float sampleRate, const float scaleFactor, + const bool isModern, const uint32_t bgColor, const uint32_t fgColor, const char* const appClassName) @@ -101,7 +102,7 @@ public: sendNoteCallback, setSizeCallback, fileRequestCallback, - bundlePath, dspPtr, scaleFactor, bgColor, fgColor, appClassName) + bundlePath, dspPtr, scaleFactor, isModern, bgColor, fgColor, appClassName) { if (widget != nullptr) *widget = (LV2UI_Widget)fUI.getNativeWindowHandle(); @@ -499,6 +500,9 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, return nullptr; } + // TODO allow classic vs modern ui type + static constexpr const bool isModern = false; + const LV2_Options_Option* options = nullptr; const LV2_URID_Map* uridMap = nullptr; void* parentId = nullptr; @@ -633,7 +637,7 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, return new UiLv2(bundlePath, winId, options, uridMap, features, controller, writeFunction, widget, instance, - sampleRate, scaleFactor, bgColor, fgColor, appClassName); + sampleRate, scaleFactor, isModern, bgColor, fgColor, appClassName); } #define uiPtr ((UiLv2*)ui) diff --git a/distrho/src/DistrhoUIPrivateData.hpp b/distrho/src/DistrhoUIPrivateData.hpp index 4a2e4494..c0c52e68 100644 --- a/distrho/src/DistrhoUIPrivateData.hpp +++ b/distrho/src/DistrhoUIPrivateData.hpp @@ -67,14 +67,14 @@ START_NAMESPACE_DISTRHO int dpf_webview_start(int argc, char* argv[]); #endif -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // Plugin Application, will set class name based on plugin details class PluginApplication : public DGL_NAMESPACE::Application { public: - explicit PluginApplication(const char* className) - : DGL_NAMESPACE::Application(DISTRHO_UI_IS_STANDALONE) + explicit PluginApplication(const char* className, const bool isModern) + : DGL_NAMESPACE::Application(DISTRHO_UI_IS_STANDALONE, isModern ? kTypeModern : kTypeClassic) { #if defined(__MOD_DEVICES__) || !defined(__EMSCRIPTEN__) if (className == nullptr) @@ -292,8 +292,8 @@ struct UI::PrivateData { setSizeFunc setSizeCallbackFunc; fileRequestFunc fileRequestCallbackFunc; - PrivateData(const char* const appClassName) noexcept - : app(appClassName), + PrivateData(const char* const appClassName, const bool isModern) noexcept + : app(appClassName, isModern), window(nullptr), #if DISTRHO_UI_USE_WEB_VIEW webview(nullptr),