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

VST3 Host: Ensure that editors open correctly on monitors with non-unity scaling

This commit is contained in:
reuk 2021-07-28 17:32:24 +01:00
parent 2465cb0d2a
commit e7d608aa48

View file

@ -1505,12 +1505,12 @@ struct VST3PluginWindow : public AudioProcessorEditor,
void nativeScaleFactorChanged (double newScaleFactor) override
{
if (pluginHandle == HandleFormat{} || approximatelyEqual ((float) newScaleFactor, nativeScaleFactor))
if (approximatelyEqual ((float) newScaleFactor, nativeScaleFactor))
return;
nativeScaleFactor = (float) newScaleFactor;
if (scaleInterface != nullptr)
if (pluginHandle != HandleFormat{} && scaleInterface != nullptr)
scaleInterface->setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) nativeScaleFactor);
}
@ -1530,6 +1530,13 @@ struct VST3PluginWindow : public AudioProcessorEditor,
resizeWithRect (embeddedComponent, *newSize, nativeScaleFactor);
setSize (embeddedComponent.getWidth(), embeddedComponent.getHeight());
// According to the VST3 Workflow Diagrams, a resizeView from the plugin should
// always trigger a response from the host which confirms the new size.
ViewRect rect;
rect.right = (Steinberg::int32) roundToInt ((float) getWidth() * nativeScaleFactor);
rect.bottom = (Steinberg::int32) roundToInt ((float) getHeight() * nativeScaleFactor);
view->onSize (&rect);
return kResultTrue;
}
@ -1597,7 +1604,7 @@ private:
#if JUCE_WINDOWS
struct ChildComponent : public Component
{
ChildComponent() {}
ChildComponent() { setOpaque (true); }
void paint (Graphics& g) override { g.fillAll (Colours::cornflowerblue); }
using Component::createNewPeer;