diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index 316cc216..d31eeb4d 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -74,8 +74,13 @@ public: /** UI class constructor. The UI should be initialized to a default state that matches the plugin side. + + When @a automaticallyScale is set to true, DPF will automatically scale up the UI + to fit the host/desktop scale factor.@n + It assumes aspect ratio is meant to be kept. + Manually call setGeometryConstraints instead if keeping UI aspect ratio is not required. */ - UI(uint width = 0, uint height = 0); + UI(uint width = 0, uint height = 0, bool automaticallyScale = false); /** Destructor. diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp index 3052ef4b..5c7e27fa 100644 --- a/distrho/src/DistrhoUI.cpp +++ b/distrho/src/DistrhoUI.cpp @@ -46,13 +46,18 @@ PluginWindow& UI::PrivateData::createNextWindow(UI* const ui, const uint width, /* ------------------------------------------------------------------------------------------------------------ * UI */ -UI::UI(const uint width, const uint height) +UI::UI(const uint width, const uint height, const bool automaticallyScale) : UIWidget(UI::PrivateData::createNextWindow(this, width, height)), uiData(UI::PrivateData::s_nextPrivateData) { #if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI if (width > 0 && height > 0) + { Widget::setSize(width, height); + + if (automaticallyScale) + setGeometryConstraints(width, height, true, true); + } #endif }