From 12bf589be943cc0a3eecdc4ab40bb5fee6499e6f Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 10 Sep 2022 11:53:02 +0100 Subject: [PATCH] Deal with plugin-initiated UI resize for CLAP Signed-off-by: falkTX --- dgl/Window.hpp | 2 +- dgl/src/WindowPrivateData.cpp | 4 ++-- distrho/src/DistrhoUIPrivateData.hpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dgl/Window.hpp b/dgl/Window.hpp index c32ba0fd..99719888 100644 --- a/dgl/Window.hpp +++ b/dgl/Window.hpp @@ -541,7 +541,7 @@ private: uint height, double scaleFactor, bool resizable, - bool isVST3, + bool usesSizeRequest, bool doPostInit); DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window) diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp index 6b32e0ce..2105670d 100644 --- a/dgl/src/WindowPrivateData.cpp +++ b/dgl/src/WindowPrivateData.cpp @@ -184,7 +184,7 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, Window::PrivateData::PrivateData(Application& a, Window* const s, const uintptr_t parentWindowHandle, const uint width, const uint height, - const double scale, const bool resizable, const bool isVST3) + const double scale, const bool resizable, const bool usesSizeRequest_) : app(a), appData(a.pData), self(s), @@ -193,7 +193,7 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, isClosed(parentWindowHandle == 0), isVisible(parentWindowHandle != 0 && view != nullptr), isEmbed(parentWindowHandle != 0), - usesSizeRequest(isVST3), + usesSizeRequest(usesSizeRequest_), scaleFactor(scale != 0.0 ? scale : getScaleFactorFromParent(view)), autoScaling(false), autoScaleFactor(1.0), diff --git a/distrho/src/DistrhoUIPrivateData.hpp b/distrho/src/DistrhoUIPrivateData.hpp index 0661afac..dfe78ed8 100644 --- a/distrho/src/DistrhoUIPrivateData.hpp +++ b/distrho/src/DistrhoUIPrivateData.hpp @@ -38,10 +38,10 @@ # define DISTRHO_UI_IS_STANDALONE 0 #endif -#ifdef DISTRHO_PLUGIN_TARGET_VST3 -# define DISTRHO_UI_IS_VST3 1 +#if defined(DISTRHO_PLUGIN_TARGET_VST3) || defined(DISTRHO_PLUGIN_TARGET_CLAP) +# define DISTRHO_UI_USES_SIZE_REQUEST true #else -# define DISTRHO_UI_IS_VST3 0 +# define DISTRHO_UI_USES_SIZE_REQUEST false #endif #ifdef DISTRHO_PLUGIN_TARGET_VST2 @@ -183,7 +183,7 @@ public: const uint height, const double scaleFactor) : Window(app, parentWindowHandle, width, height, scaleFactor, - DISTRHO_UI_USER_RESIZABLE, DISTRHO_UI_IS_VST3, false), + DISTRHO_UI_USER_RESIZABLE, DISTRHO_UI_USES_SIZE_REQUEST, false), ui(uiPtr), initializing(true), receivedReshapeDuringInit(false)