mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
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
This commit is contained in:
parent
b11560c4ca
commit
9cfbb2082f
1 changed files with 14 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue