DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 3174edc24323ad3e969eb1aaee5ca171c0af0c66
parent 21837f9d0dea6ec3d4e578c9553577742d4f04ef
Author: falkTX <falktx@falktx.com>
Date:   Sat,  5 Jun 2021 13:52:05 +0100

Fix getSize() returning zero during UI constructor

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/TopLevelWidget.hpp | 8++++----
Mdistrho/src/DistrhoUI.cpp | 8+++++++-
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dgl/TopLevelWidget.hpp b/dgl/TopLevelWidget.hpp @@ -68,25 +68,25 @@ public: /** Set width of this widget's window. - @note This will not change the widget's size right away, but be pending on OS resizing the window + @note This will not change the widget's size right away, but be pending on the OS resizing the window */ void setWidth(uint width); /** Set height of this widget's window. - @note This will not change the widget's size right away, but be pending on OS resizing the window + @note This will not change the widget's size right away, but be pending on the OS resizing the window */ void setHeight(uint height); /** Set size of this widget's window, using @a width and @a height values. - @note This will not change the widget's size right away, but be pending on OS resizing the window + @note This will not change the widget's size right away, but be pending on the OS resizing the window */ void setSize(uint width, uint height); /** Set size of this widget's window. - @note This will not change the widget's size right away, but be pending on OS resizing the window + @note This will not change the widget's size right away, but be pending on the OS resizing the window */ void setSize(const Size<uint>& size); diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp @@ -48,7 +48,13 @@ PluginWindow& UI::PrivateData::createNextWindow(UI* const ui, const uint width, UI::UI(const uint width, const uint height) : UIWidget(UI::PrivateData::createNextWindow(this, width, height)), - uiData(UI::PrivateData::s_nextPrivateData) {} + uiData(UI::PrivateData::s_nextPrivateData) +{ +#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI + if (width > 0 && height > 0) + Widget::setSize(width, height); +#endif +} UI::~UI() {