From a1748a1a9fd1ac6f8b8abaa26cec64f121d13d7e Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 30 Sep 2018 16:03:28 +0200 Subject: Assume Windows to be resizable by default; Add UI::isUserResizable --- dgl/src/Window.cpp | 2 +- distrho/DistrhoUI.hpp | 6 ++++++ distrho/src/DistrhoPluginLV2export.cpp | 31 +++++++++++++++++++++++++------ distrho/src/DistrhoUI.cpp | 5 +++++ 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 06549785..18c0d5f6 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -153,7 +153,7 @@ struct Window::PrivateData { fView(puglInit()), fFirstInit(true), fVisible(parentId != 0), - fResizable(parentId == 0), + fResizable(true), fUsingEmbed(parentId != 0), fWidth(1), fHeight(1), diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index 6975a699..b5e44e49 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -61,6 +61,12 @@ public: */ virtual ~UI(); + /** + Wherever this UI is resizable by the user. + This simply returns the value passed in the constructor. + */ + bool isUserResizable() const noexcept; + /** Set geometry constraints for the UI when resized by the user, and optionally scale UI automatically. @see Window::setGeometryConstraints(uint,uint,bool) diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index 6ed2f7c5..08103f4d 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -139,8 +139,17 @@ void lv2_generate_ttl(const char* const basename) # endif manifestString += "\n"; # if DISTRHO_PLUGIN_HAS_EMBED_UI - manifestString += " lv2:optionalFeature ui:noUserResize ,\n"; - manifestString += " ui:resize ,\n"; + /* + if (! pluginUI.isUserResizable()) + { + manifestString += " lv2:optionalFeature ui:noUserResize ,\n"; + manifestString += " ui:resize ,\n"; + } + else + */ + { + manifestString += " lv2:optionalFeature ui:resize ,\n"; + } manifestString += " ui:touch ;\n"; manifestString += "\n"; # endif @@ -148,9 +157,10 @@ void lv2_generate_ttl(const char* const basename) manifestString += " <" LV2_INSTANCE_ACCESS_URI "> ,\n"; manifestString += " <" LV2_OPTIONS__options "> ,\n"; manifestString += " <" LV2_URID__map "> .\n"; -# else + manifestString += " opts:supportedOption <" LV2_PARAMETERS__sampleRate "> .\n"; +# else // DISTRHO_PLUGIN_WANT_DIRECT_ACCESS manifestString += " rdfs:seeAlso <" + uiTTL + "> .\n"; -# endif +# endif // DISTRHO_PLUGIN_WANT_DIRECT_ACCESS manifestString += "\n"; #endif @@ -628,8 +638,17 @@ void lv2_generate_ttl(const char* const basename) # endif uiString += "\n"; # if DISTRHO_PLUGIN_HAS_EMBED_UI - uiString += " lv2:optionalFeature ui:noUserResize ,\n"; - uiString += " ui:resize ,\n"; + /* + if (! pluginUI.isUserResizable()) + { + uiString += " lv2:optionalFeature ui:noUserResize ,\n"; + uiString += " ui:resize ,\n"; + } + else + */ + { + uiString += " lv2:optionalFeature ui:resize ,\n"; + } uiString += " ui:touch ;\n"; uiString += "\n"; # endif diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp index e48e365c..f83d0775 100644 --- a/distrho/src/DistrhoUI.cpp +++ b/distrho/src/DistrhoUI.cpp @@ -57,6 +57,11 @@ UI::~UI() delete pData; } +bool UI::isUserResizable() const noexcept +{ + return pData->userResizable; +} + void UI::setGeometryConstraints(uint minWidth, uint minHeight, bool keepAspectRatio, bool automaticallyScale) { DISTRHO_SAFE_ASSERT_RETURN(minWidth > 0,); -- cgit v1.2.3