From 5ea5afbd2a00d435ad464af1972d70381bc2285f Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 28 Jul 2021 19:25:08 +0100 Subject: [PATCH] VST Host: Avoid resizing plugin views directly on Windows Previously, plugin views may be set to unexpected sizes by the host, which could interrupt size updates due to scale factor changes. This could leave the plugin view at an incorrect size. --- .../format_types/juce_VSTPluginFormat.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 97d8fc7a8b..7771cbb894 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -2898,23 +2898,24 @@ public: { const ScopedValueSetter recursiveResizeSetter (recursiveResize, true); - const auto editorSize = plugin.getEditorSize(); const auto pos = (peer->getAreaCoveredBy (*this).toFloat() * nativeScaleFactor).toNearestInt(); #if JUCE_WINDOWS if (pluginHWND != 0) { ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND }; - MoveWindow (pluginHWND, - pos.getX(), - pos.getY(), - editorSize.getWidth(), - editorSize.getHeight(), - TRUE); + SetWindowPos (pluginHWND, + HWND_BOTTOM, + pos.getX(), + pos.getY(), + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); } #elif JUCE_LINUX || JUCE_BSD if (pluginWindow != 0) { + const auto editorSize = plugin.getEditorSize(); auto* symbols = X11Symbols::getInstance(); symbols->xMoveResizeWindow (display, pluginWindow,