From 718097fd603fdb77a92617ca76e28fc9a9db0900 Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 13 Oct 2021 19:18:54 +0100 Subject: [PATCH] StandaloneFilterWindow: Avoid recursively resizing plugin editor --- .../Standalone/juce_StandaloneFilterWindow.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index a011a96a48..85ebc27d42 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -904,9 +904,14 @@ private: notification.setBounds (r.removeFromTop (NotificationArea::height)); if (editor != nullptr) - editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()) - .withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted())) - .toNearestInt()); + { + const auto newPos = r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted()); + + if (preventResizingEditor) + editor->setTopLeftPosition (newPos.roundToInt()); + else + editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()).withPosition (newPos).toNearestInt()); + } } private: @@ -1001,6 +1006,8 @@ private: //============================================================================== void componentMovedOrResized (Component&, bool, bool) override { + const ScopedValueSetter scope (preventResizingEditor, true); + if (editor != nullptr) { auto rect = getSizeToContainEditor(); @@ -1024,6 +1031,7 @@ private: std::unique_ptr editor; Value inputMutedValue; bool shouldShowNotification = false; + bool preventResizingEditor = false; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent) };