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

VST3: Added a workaround for Windows DPI-aware Cubase 10 opening plug-in editor with double scaled bounds

This commit is contained in:
ed 2019-01-02 14:40:45 +00:00
parent bca872193c
commit 64cd94f8ae

View file

@ -908,6 +908,23 @@ private:
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
w = roundToInt (w / editorScaleFactor);
h = roundToInt (h / editorScaleFactor);
bool needToResizeHostWindow = false;
if (getHostType().type == PluginHostType::SteinbergCubase10)
{
auto integerScaleFactor = (int) std::round (editorScaleFactor);
// Workaround for Cubase 10 sending double-scaled bounds when opening editor
if (isWithin ((int) w, component->getWidth() * integerScaleFactor, 2)
&& isWithin ((int) h, component->getHeight() * integerScaleFactor, 2))
{
w /= integerScaleFactor;
h /= integerScaleFactor;
needToResizeHostWindow = true;
}
}
#endif
component->setSize (w, h);
@ -919,6 +936,11 @@ private:
#endif
if (auto* peer = component->getPeer())
peer->updateBounds();
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
if (needToResizeHostWindow)
component->resizeHostWindow();
#endif
}
return kResultTrue;