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

VST3: Added a workaround for Cubase 10 resizing the host window after the plug-in on macOS

This commit is contained in:
ed 2018-12-18 17:15:23 +00:00
parent 51fed8f8bf
commit 954663b8bb

View file

@ -811,6 +811,11 @@ private:
editorScaleFactor = ec.lastScaleFactorReceived;
component.reset (new ContentWrapperComponent (*this, p));
#if JUCE_MAC
if (getHostType().type == PluginHostType::SteinbergCubase10)
cubase10Workaround.reset (new Cubase10WindowResizeWorkaround (*this));
#endif
}
tresult PLUGIN_API queryInterface (const TUID targetIID, void** obj) override
@ -907,6 +912,11 @@ private:
component->setSize (w, h);
#if JUCE_MAC
if (cubase10Workaround != nullptr)
cubase10Workaround->triggerAsyncUpdate();
else
#endif
if (auto* peer = component->getPeer())
peer->updateBounds();
}
@ -1211,6 +1221,23 @@ private:
#if JUCE_MAC
void* macHostWindow = nullptr;
bool isNSView = false;
// On macOS Cubase 10 resizes the host window after calling onSize() resulting in the peer
// bounds being a step behind the plug-in. Calling updateBounds() asynchronously seems to fix things...
struct Cubase10WindowResizeWorkaround : public AsyncUpdater
{
Cubase10WindowResizeWorkaround (JuceVST3Editor& o) : owner (o) {}
void handleAsyncUpdate() override
{
if (auto* peer = owner.component->getPeer())
peer->updateBounds();
}
JuceVST3Editor& owner;
};
std::unique_ptr<Cubase10WindowResizeWorkaround> cubase10Workaround;
#endif
float editorScaleFactor = 1.0f;