From 690bfd2c4775a0734912fc7ec70f42adbec9e063 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 5 Sep 2025 23:11:55 +0200 Subject: [PATCH] Use classic app type in CLAP, LV2, VST2 and VST3, auto in others Signed-off-by: falkTX --- dgl/src/pugl.cpp | 2 +- distrho/src/DistrhoPluginCLAP.cpp | 5 +++-- distrho/src/DistrhoPluginVST2.cpp | 5 +++-- distrho/src/DistrhoUIInternal.hpp | 12 ++++++------ distrho/src/DistrhoUILV2.cpp | 28 ++++++++++++++-------------- distrho/src/DistrhoUIPrivateData.hpp | 20 ++++++++++---------- distrho/src/DistrhoUIVST3.cpp | 5 +++-- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index 87641764..2724f54d 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -974,7 +974,7 @@ PuglWorldInternals* puglInitWorldInternals(PuglWorld* const world, const PuglWor { if (std::strcmp(backend, "x11") == 0) usingX11 = true; - else if (std::strcmp(backend, "wayland") != 0) + else if (std::strcmp(backend, "wayland") == 0) usingWayland = true; else d_stderr("Unknown DPF_BACKEND value, must be 'x11' or 'wayland'"); diff --git a/distrho/src/DistrhoPluginCLAP.cpp b/distrho/src/DistrhoPluginCLAP.cpp index 4ee36287..dd6859cf 100644 --- a/distrho/src/DistrhoPluginCLAP.cpp +++ b/distrho/src/DistrhoPluginCLAP.cpp @@ -286,7 +286,7 @@ public: #else UIExporter tmpUI(nullptr, 0, fPlugin.getSampleRate(), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath, - fPlugin.getInstancePointer(), scaleFactor); + fPlugin.getInstancePointer(), scaleFactor, DGL_NAMESPACE::Application::kTypeClassic); *width = tmpUI.getWidth(); *height = tmpUI.getHeight(); scaleFactor = tmpUI.getScaleFactor(); @@ -584,7 +584,8 @@ private: nullptr, // TODO fileRequestCallback, d_nextBundlePath, fPlugin.getInstancePointer(), - fScaleFactor); + fScaleFactor, + DGL_NAMESPACE::Application::kTypeClassic); #if DISTRHO_PLUGIN_WANT_PROGRAMS fUI->programLoaded(fCurrentProgram); diff --git a/distrho/src/DistrhoPluginVST2.cpp b/distrho/src/DistrhoPluginVST2.cpp index 686341a8..c3e67fee 100644 --- a/distrho/src/DistrhoPluginVST2.cpp +++ b/distrho/src/DistrhoPluginVST2.cpp @@ -175,7 +175,8 @@ public: nullptr, // TODO file request d_nextBundlePath, plugin->getInstancePointer(), - scaleFactor), + scaleFactor, + DGL_NAMESPACE::Application::kTypeClassic), fKeyboardModifiers(0) #if DISTRHO_PLUGIN_WANT_MIDI_INPUT , fNotesRingBuffer() @@ -600,7 +601,7 @@ public: #else UIExporter tmpUI(nullptr, 0, fPlugin.getSampleRate(), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath, - fPlugin.getInstancePointer(), scaleFactor); + fPlugin.getInstancePointer(), scaleFactor, DGL_NAMESPACE::Application::kTypeClassic); fVstRect.right = tmpUI.getWidth(); fVstRect.bottom = tmpUI.getHeight(); scaleFactor = tmpUI.getScaleFactor(); diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index 3e6ebde8..f7b578e6 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -21,18 +21,18 @@ START_NAMESPACE_DISTRHO -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // UI exporter class class UIExporter { - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------------------------------------- // UI Widget and its private data UI* ui; UI::PrivateData* uiData; - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------------------------------------- public: UIExporter(void* const callbacksPtr, @@ -47,12 +47,12 @@ public: const char* const bundlePath = nullptr, void* const dspPtr = nullptr, const double scaleFactor = 0.0, - const bool isModern = false, + const DGL_NAMESPACE::Application::Type appType = DGL_NAMESPACE::Application::kTypeAuto, const uint32_t bgColor = 0, const uint32_t fgColor = 0xffffffff, const char* const appClassName = nullptr) : ui(nullptr), - uiData(new UI::PrivateData(appClassName, isModern)) + uiData(new UI::PrivateData(appClassName, appType)) { uiData->sampleRate = sampleRate; uiData->bundlePath = bundlePath != nullptr ? strdup(bundlePath) : nullptr; diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp index 6195b069..7f5e414c 100644 --- a/distrho/src/DistrhoUILV2.cpp +++ b/distrho/src/DistrhoUILV2.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2025 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -52,7 +52,7 @@ static constexpr const sendNoteFunc sendNoteCallback = nullptr; // unwanted in LV2, resize extension is deprecated and hosts can do it without extensions static constexpr const setSizeFunc setSizeCallback = nullptr; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- template static const LV2F* getLv2Feature(const LV2_Feature* const* features, const char* const uri) @@ -80,7 +80,7 @@ public: void* const dspPtr, const float sampleRate, const float scaleFactor, - const bool isModern, + const DGL_NAMESPACE::Application::Type appType, const uint32_t bgColor, const uint32_t fgColor, const char* const appClassName) @@ -102,7 +102,7 @@ public: sendNoteCallback, setSizeCallback, fileRequestCallback, - bundlePath, dspPtr, scaleFactor, isModern, bgColor, fgColor, appClassName) + bundlePath, dspPtr, scaleFactor, appType, bgColor, fgColor, appClassName) { if (widget != nullptr) *widget = (LV2UI_Widget)fUI.getNativeWindowHandle(); @@ -484,7 +484,7 @@ private: } }; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* const uri, @@ -501,7 +501,7 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, } // TODO allow classic vs modern ui type - static constexpr const bool isModern = false; + static constexpr const DGL_NAMESPACE::Application::Type appType = DGL_NAMESPACE::Application::kTypeClassic; const LV2_Options_Option* options = nullptr; const LV2_URID_Map* uridMap = nullptr; @@ -637,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, isModern, bgColor, fgColor, appClassName); + sampleRate, scaleFactor, appType, bgColor, fgColor, appClassName); } #define uiPtr ((UiLv2*)ui) @@ -652,7 +652,7 @@ static void lv2ui_port_event(LV2UI_Handle ui, uint32_t portIndex, uint32_t buffe uiPtr->lv2ui_port_event(portIndex, bufferSize, format, buffer); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- static int lv2ui_idle(LV2UI_Handle ui) { @@ -669,7 +669,7 @@ static int lv2ui_hide(LV2UI_Handle ui) return uiPtr->lv2ui_hide(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- static uint32_t lv2_get_options(LV2UI_Handle ui, LV2_Options_Option* options) { @@ -681,7 +681,7 @@ static uint32_t lv2_set_options(LV2UI_Handle ui, const LV2_Options_Option* optio return uiPtr->lv2_set_options(options); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- #if DISTRHO_PLUGIN_WANT_PROGRAMS static void lv2ui_select_program(LV2UI_Handle ui, uint32_t bank, uint32_t program) @@ -690,7 +690,7 @@ static void lv2ui_select_program(LV2UI_Handle ui, uint32_t bank, uint32_t progra } #endif -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- static const void* lv2ui_extension_data(const char* uri) { @@ -717,7 +717,7 @@ static const void* lv2ui_extension_data(const char* uri) #undef instancePtr -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- static const LV2UI_Descriptor sLv2UiDescriptor = { DISTRHO_UI_URI, @@ -727,7 +727,7 @@ static const LV2UI_Descriptor sLv2UiDescriptor = { lv2ui_extension_data }; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- END_NAMESPACE_DISTRHO @@ -933,4 +933,4 @@ void modgui_cleanup(const LV2UI_Handle handle) } #endif -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- diff --git a/distrho/src/DistrhoUIPrivateData.hpp b/distrho/src/DistrhoUIPrivateData.hpp index c0c52e68..108e76b6 100644 --- a/distrho/src/DistrhoUIPrivateData.hpp +++ b/distrho/src/DistrhoUIPrivateData.hpp @@ -73,8 +73,8 @@ int dpf_webview_start(int argc, char* argv[]); class PluginApplication : public DGL_NAMESPACE::Application { public: - explicit PluginApplication(const char* className, const bool isModern) - : DGL_NAMESPACE::Application(DISTRHO_UI_IS_STANDALONE, isModern ? kTypeModern : kTypeClassic) + explicit PluginApplication(const char* className, const Application::Type type) + : DGL_NAMESPACE::Application(DISTRHO_UI_IS_STANDALONE, type) { #if defined(__MOD_DEVICES__) || !defined(__EMSCRIPTEN__) if (className == nullptr) @@ -108,7 +108,7 @@ public: DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginApplication) }; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // Plugin Window, will pass some Window events to UI class PluginWindow : public DGL_NAMESPACE::Window @@ -243,7 +243,7 @@ protected: DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginWindow) }; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // UI callbacks typedef void (*editParamFunc) (void* ptr, uint32_t rindex, bool started); @@ -253,7 +253,7 @@ typedef void (*sendNoteFunc) (void* ptr, uint8_t channel, uint8_t note, uint8 typedef void (*setSizeFunc) (void* ptr, uint width, uint height); typedef bool (*fileRequestFunc) (void* ptr, const char* key); -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // UI private data struct UI::PrivateData { @@ -292,8 +292,8 @@ struct UI::PrivateData { setSizeFunc setSizeCallbackFunc; fileRequestFunc fileRequestCallbackFunc; - PrivateData(const char* const appClassName, const bool isModern) noexcept - : app(appClassName, isModern), + PrivateData(const char* const appClassName, const DGL_NAMESPACE::Application::Type appType) noexcept + : app(appClassName, appType), window(nullptr), #if DISTRHO_UI_USE_WEB_VIEW webview(nullptr), @@ -392,7 +392,7 @@ struct UI::PrivateData { #endif }; -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // UI private data fileRequestCallback, which requires PluginWindow definitions inline bool UI::PrivateData::fileRequestCallback(const char* const key) @@ -419,7 +419,7 @@ inline bool UI::PrivateData::fileRequestCallback(const char* const key) return false; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // PluginWindow onFileSelected that require UI::PrivateData definitions #if DISTRHO_UI_FILE_BROWSER @@ -457,7 +457,7 @@ inline void PluginWindow::onFileSelected(const char* const filename) } #endif -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- END_NAMESPACE_DISTRHO diff --git a/distrho/src/DistrhoUIVST3.cpp b/distrho/src/DistrhoUIVST3.cpp index a326c4b3..744551c4 100644 --- a/distrho/src/DistrhoUIVST3.cpp +++ b/distrho/src/DistrhoUIVST3.cpp @@ -205,7 +205,8 @@ public: nullptr, // TODO file request d_nextBundlePath, instancePointer, - scaleFactor) + scaleFactor, + DGL_NAMESPACE::Application::kTypeClassic) { } @@ -1374,7 +1375,7 @@ struct dpf_plugin_view : v3_plugin_view_cpp { #else UIExporter tmpUI(nullptr, 0, view->sampleRate, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath, - view->instancePointer, scaleFactor); + view->instancePointer, scaleFactor, DGL_NAMESPACE::Application::kTypeClassic); rect->right = tmpUI.getWidth(); rect->bottom = tmpUI.getHeight(); scaleFactor = tmpUI.getScaleFactor();