From db618477ff14d27c863986a04ec90979cb069e53 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 12 Mar 2021 17:17:39 +0000 Subject: [PATCH] Standalone: Respect AudioProcessorEditor resize limits --- .../Standalone/juce_StandaloneFilterWindow.h | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 3ec1bed66d..fc8d4e394b 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -819,10 +819,22 @@ private: #else if (editor != nullptr) { - auto rect = getSizeToContainEditor(); - - setSize (rect.getWidth(), - rect.getHeight() + (shouldShowNotification ? NotificationArea::height : 0)); + const int extraHeight = shouldShowNotification ? NotificationArea::height : 0; + const auto rect = getSizeToContainEditor(); + + if (auto* editorConstrainer = editor->getConstrainer()) + { + const auto borders = owner.getContentComponentBorder(); + const auto extraWindowWidth = borders.getLeftAndRight(); + const auto extraWindowHeight = extraHeight + borders.getTopAndBottom(); + + owner.setResizeLimits (editorConstrainer->getMinimumWidth() + extraWindowWidth, + editorConstrainer->getMinimumHeight() + extraWindowHeight, + editorConstrainer->getMaximumWidth() + extraWindowWidth, + editorConstrainer->getMaximumHeight() + extraWindowHeight); + } + + setSize (rect.getWidth(), rect.getHeight() + extraHeight); } #endif }