DPF

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

commit c2a3737d8bccf5d2787298267e273c5810156ce2
parent 287f43675baa96790997d35cb161e38ef832b3ac
Author: falkTX <falktx@falktx.com>
Date:   Fri, 28 May 2021 22:26:18 +0100

Cleanup lv2 ui resizing, stick with current best possible approach

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

Diffstat:
Mdistrho/src/DistrhoUILV2.cpp | 28++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp @@ -97,8 +97,12 @@ public: fURIDs(uridMap), fWinIdWasNull(winId == 0) { +#if ! DISTRHO_UI_USER_RESIZABLE + // this is not needed, hosts can query child window size + // it is best for them to do so anyway, since properties other than current-size are important (like ratio) if (fUiResize != nullptr && winId != 0) fUiResize->ui_resize(fUiResize->handle, fUI.getWidth(), fUI.getHeight()); +#endif if (widget != nullptr) *widget = (LV2UI_Widget)fUI.getNativeWindowHandle(); @@ -206,13 +210,6 @@ public: return fUI.setWindowVisible(false) ? 0 : 1; } - int lv2ui_resize(uint width, uint height) - { - // this comes from the host - // fUI.setWindowSize(width, height, true); - return 0; - } - // ------------------------------------------------------------------- uint32_t lv2_get_options(LV2_Options_Option* const /*options*/) @@ -334,8 +331,8 @@ protected: void setSize(const uint width, const uint height) { - // fUI.setWindowSize(width, height); - + // report window size change to host. + // at the moment no lv2 hosts automatically adapt to child window size changes, so this is still needed if (fUiResize != nullptr && ! fWinIdWasNull) fUiResize->ui_resize(fUiResize->handle, width, height); } @@ -614,16 +611,6 @@ static int lv2ui_hide(LV2UI_Handle ui) return uiPtr->lv2ui_hide(); } -static int lv2ui_resize(LV2UI_Handle ui, int width, int height) -{ - DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr, 1); - DISTRHO_SAFE_ASSERT_RETURN(width > 0, 1); - DISTRHO_SAFE_ASSERT_RETURN(height > 0, 1); - - return 1; // This needs more testing - //return uiPtr->lv2ui_resize(width, height); -} - // ----------------------------------------------------------------------- static uint32_t lv2_get_options(LV2UI_Handle ui, LV2_Options_Option* options) @@ -652,7 +639,6 @@ static const void* lv2ui_extension_data(const char* uri) static const LV2_Options_Interface options = { lv2_get_options, lv2_set_options }; static const LV2UI_Idle_Interface uiIdle = { lv2ui_idle }; static const LV2UI_Show_Interface uiShow = { lv2ui_show, lv2ui_hide }; - static const LV2UI_Resize uiResz = { nullptr, lv2ui_resize }; if (std::strcmp(uri, LV2_OPTIONS__interface) == 0) return &options; @@ -660,8 +646,6 @@ static const void* lv2ui_extension_data(const char* uri) return &uiIdle; if (std::strcmp(uri, LV2_UI__showInterface) == 0) return &uiShow; - if (std::strcmp(uri, LV2_UI__resize) == 0) - return &uiResz; #if DISTRHO_PLUGIN_WANT_PROGRAMS static const LV2_Programs_UI_Interface uiPrograms = { lv2ui_select_program };