Browse Source

VST3: Fixed a potential crash that could occur if a host sets the scale factor after closing the plug-in editor, and ensure that the last scale factor is re-used when opening the editor

tags/2021-05-28
ed 7 years ago
parent
commit
9cfbb2082f
1 changed files with 14 additions and 3 deletions
  1. +14
    -3
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp

+ 14
- 3
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -844,6 +844,10 @@ private:
macHostWindow = juce::attachComponentToWindowRefVST (component.get(), parent, isNSView);
#endif
#if ! JUCE_MAC
setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) scaleFactor);
#endif
component->resizeHostWindow();
systemWindow = parent;
attachedToParent();
@@ -959,12 +963,17 @@ private:
tresult PLUGIN_API setContentScaleFactor (Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override
{
#if ! JUCE_MAC
scaleFactor = static_cast<float> (factor);
if (component == nullptr)
return kResultFalse;
#if JUCE_WINDOWS && ! JUCE_WIN_PER_MONITOR_DPI_AWARE
if (auto* ed = component->pluginEditor.get())
ed->setScaleFactor ((float) factor);
ed->setScaleFactor (scaleFactor);
#else
if (! approximatelyEqual (component->getNativeEditorScaleFactor(), (float) factor))
component->nativeScaleFactorChanged ((double) factor);
if (! approximatelyEqual (component->getNativeEditorScaleFactor(), scaleFactor))
component->nativeScaleFactorChanged ((double) scaleFactor);
#endif
component->resizeHostWindow();
@@ -1198,6 +1207,8 @@ private:
#if JUCE_MAC
void* macHostWindow = nullptr;
bool isNSView = false;
#else
float scaleFactor = 1.0f;
#endif
#if JUCE_WINDOWS


Loading…
Cancel
Save