From 61cdcff2e90be18ba59d7ebeeb4e94949e6d7ab3 Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 29 Sep 2021 16:01:03 +0100 Subject: [PATCH] VST3 Host: Ensure requested size is applied, even when plugin does not support scaling This fixes some issues with Izotope Ozone 9: - Resizing would stutter, and could leave the view in an inconsistent state. - Closing and reopening the view after resizing would display black bars around the editor view. The root of the problem was that the call to Component::setSize() inside the resizeView call checked whether the plugin supported resizing. If not, it would force the embedded view back to the current size. This behaviour is incorrect - if the plugin requests a resize via resizeView, the new size should be applied whether or not the plugin "supports resizing". --- .../format_types/juce_VST3PluginFormat.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 06d0ee3c84..050a11ab46 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -1525,6 +1525,8 @@ private: tresult PLUGIN_API resizeView (IPlugView* incomingView, ViewRect* newSize) override { + const ScopedValueSetter recursiveResizeSetter (recursiveResize, true); + if (incomingView != nullptr && newSize != nullptr && incomingView == view) { auto scaleToViewRect = [this] (int dimension) @@ -1536,6 +1538,11 @@ private: auto oldHeight = scaleToViewRect (getHeight()); resizeWithRect (embeddedComponent, *newSize, nativeScaleFactor); + + #if JUCE_WINDOWS + setPluginWindowPos (*newSize); + #endif + setSize (embeddedComponent.getWidth(), embeddedComponent.getHeight()); // According to the VST3 Workflow Diagrams, a resizeView from the plugin should