1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

VST3 Client: Fix occasional incorrect scaling in Ableton Live when rendering with OpenGL

This patch fixes an issue where closing and reopening a plugin editor in
Live could cause it to display at the wrong scale when using OpenGL.
This commit is contained in:
reuk 2022-08-02 17:42:47 +01:00
parent ceb601af64
commit 11b4672b55

View file

@ -1734,9 +1734,6 @@ private:
#if JUCE_MAC #if JUCE_MAC
if (getHostType().type == PluginHostType::SteinbergCubase10) if (getHostType().type == PluginHostType::SteinbergCubase10)
cubase10Workaround.reset (new Cubase10WindowResizeWorkaround (*this)); cubase10Workaround.reset (new Cubase10WindowResizeWorkaround (*this));
#else
if (! approximatelyEqual (editorScaleFactor, ec.lastScaleFactorReceived))
setContentScaleFactor (ec.lastScaleFactorReceived);
#endif #endif
} }
@ -1784,12 +1781,25 @@ private:
createContentWrapperComponentIfNeeded(); createContentWrapperComponentIfNeeded();
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
// If the plugin was last opened at a particular scale, try to reapply that scale here.
// Note that we do this during attach(), rather than in JuceVST3Editor(). During the
// constructor, we don't have a host plugFrame, so
// ContentWrapperComponent::resizeHostWindow() won't do anything, and the content
// wrapper component will be left at the wrong size.
if (! approximatelyEqual (editorScaleFactor, owner->lastScaleFactorReceived))
setContentScaleFactor (owner->lastScaleFactorReceived);
// Check the host scale factor *before* calling addToDesktop, so that the initial
// window size during addToDesktop is correct for the current platform scale factor.
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
component->checkHostWindowScaleFactor();
#endif
component->setOpaque (true); component->setOpaque (true);
component->addToDesktop (0, (void*) systemWindow); component->addToDesktop (0, (void*) systemWindow);
component->setVisible (true); component->setVisible (true);
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
component->checkHostWindowScaleFactor();
component->startTimer (500); component->startTimer (500);
#endif #endif