diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index 348e80b07..bcc939cee 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -389,10 +389,12 @@ public: { if (fWindow == nullptr) { + const EngineOptions& opts(pData->engine->getOptions()); + juce::String uiName(pData->name); uiName += " (GUI)"; - fWindow = new JucePluginWindow(pData->engine->getOptions().frontendWinId); + fWindow = new JucePluginWindow(opts.frontendWinId, opts.uiScale); fWindow->setName(uiName); } diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 9a79c28c6..2fa0c3a66 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -40,9 +40,6 @@ #undef VST_FORCE_DEPRECATED #define VST_FORCE_DEPRECATED 0 -#undef kEffectMagic -#define kEffectMagic (CCONST( 'V', 's', 't', 'P' )) - using water::ByteOrder; CARLA_BACKEND_START_NAMESPACE @@ -530,6 +527,13 @@ public: { fUI.isOpen = true; + // pass ui scale to plugin + dispatcher(effVendorSpecific, + CCONST('P', 'r', 'e', 'S'), + CCONST('A', 'e', 'C', 's'), + nullptr, + pData->engine->getOptions().uiScale); + ERect* vstRect = nullptr; dispatcher(effEditGetRect, 0, 0, &vstRect); diff --git a/source/includes/vestige/vestige.h b/source/includes/vestige/vestige.h index 72f1c9c4f..07c4698d3 100644 --- a/source/includes/vestige/vestige.h +++ b/source/includes/vestige/vestige.h @@ -38,10 +38,17 @@ # define __cdecl #endif -#define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \ - ( ( (int) b ) << 16 ) | \ - ( ( (int) c ) << 8 ) | \ - ( ( (int) d ) << 0 ) ) +#ifdef WORDS_BIGENDIAN +#define CCONST(a, b, c, d) ( ( ( (int) a ) << 0 ) | \ + ( ( (int) b ) << 8 ) | \ + ( ( (int) c ) << 16 ) | \ + ( ( (int) d ) << 24 ) ) +#else +#define CCONST(a, b, c, d) ( ( ( (int) a ) << 24 ) | \ + ( ( (int) b ) << 16 ) | \ + ( ( (int) c ) << 8 ) | \ + ( ( (int) d ) << 0 ) ) +#endif #define audioMasterAutomate 0 #define audioMasterVersion 1 diff --git a/source/utils/JucePluginWindow.hpp b/source/utils/JucePluginWindow.hpp index 17327e360..3a9b520b6 100644 --- a/source/utils/JucePluginWindow.hpp +++ b/source/utils/JucePluginWindow.hpp @@ -36,10 +36,11 @@ namespace juce { class JucePluginWindow : public DialogWindow { public: - JucePluginWindow(const uintptr_t parentId) + JucePluginWindow(const uintptr_t parentId, const float scale) : DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false), fClosed(false), - fTransientId(parentId) + fTransientId(parentId), + fScale(scale) { setVisible(false); //setAlwaysOnTop(true); @@ -89,9 +90,15 @@ protected: return true; } + float getDesktopScaleFactor() const override + { + return fScale; + } + private: volatile bool fClosed; const uintptr_t fTransientId; + float fScale; void setTransient() {