From 28aa387f8d61defedf566778b7291443f636a969 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 6 Nov 2025 18:51:21 +0000 Subject: [PATCH] VST Host: Fix issue where the Component bounds computed for a hosted editor on Linux could be incorrect for non-unity scale factors --- .../format_types/juce_VSTPluginFormat.cpp | 13 ++++++------- 1 file changed, 6 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 e3949b70bb..cc655a52fb 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -650,18 +650,18 @@ private: void operator() (float platformScale) const { - MessageManager::callAsync ([ref = Component::SafePointer (&window), platformScale] + MessageManager::callAsync ([ref = SafePointer (&window), platformScale] { if (auto* r = ref.getComponent()) { r->nativeScaleFactor = platformScale; r->setContentScaleFactor(); - #if JUCE_WINDOWS - r->resizeToFit(); - r->embeddedComponent.updateHWNDBounds(); - #endif - r->componentMovedOrResized (true, true); + Vst2::ERect* rect = nullptr; + r->dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); + + if (rect != nullptr) + r->updateSizeFromEditor (rect->right - rect->left, rect->bottom - rect->top); } }); } @@ -809,7 +809,6 @@ private: updateHostDisplay (AudioProcessorListener::ChangeDetails().withProgramChanged (true) .withParameterInfoChanged (true)); } - }; //==============================================================================