Browse Source

VST: Resize host window when global scale factor is changed

tags/2021-05-28
ed 5 years ago
parent
commit
76910b0ebd
2 changed files with 24 additions and 12 deletions
  1. +14
    -11
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  2. +10
    -1
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp

+ 14
- 11
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -1161,23 +1161,21 @@ public:
void resized() override void resized() override
{ {
auto newBounds = getLocalBounds();
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
if (! lastBounds.isEmpty() && isWithin (newBounds.toDouble().getAspectRatio(), lastBounds.toDouble().getAspectRatio(), 0.1))
return;
lastBounds = newBounds;
#endif
if (auto* ed = getEditorComp()) if (auto* ed = getEditorComp())
{ {
ed->setTopLeftPosition (0, 0); ed->setTopLeftPosition (0, 0);
if (shouldResizeEditor) if (shouldResizeEditor)
{
auto newBounds = getLocalBounds();
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
if (! lastBounds.isEmpty() && isWithin (newBounds.toDouble().getAspectRatio(), lastBounds.toDouble().getAspectRatio(), 0.1))
return;
lastBounds = newBounds;
#endif
ed->setBounds (ed->getLocalArea (this, newBounds)); ed->setBounds (ed->getLocalArea (this, newBounds));
}
updateWindowSize (false); updateWindowSize (false);
} }
@@ -1188,6 +1186,11 @@ public:
#endif #endif
} }
void parentSizeChanged() override
{
updateWindowSize (true);
}
void childBoundsChanged (Component*) override void childBoundsChanged (Component*) override
{ {
updateWindowSize (false); updateWindowSize (false);


+ 10
- 1
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -1434,6 +1434,15 @@ private:
} }
} }
void parentSizeChanged() override
{
if (pluginEditor != nullptr)
{
resizeHostWindow();
pluginEditor->repaint();
}
}
void resizeHostWindow() void resizeHostWindow()
{ {
if (pluginEditor != nullptr) if (pluginEditor != nullptr)
@@ -1459,7 +1468,7 @@ private:
#if JUCE_MAC #if JUCE_MAC
if (host.isWavelab() || host.isReaper()) if (host.isWavelab() || host.isReaper())
#else #else
if (host.isWavelab() || host.isAbletonLive())
if (host.isWavelab() || host.isAbletonLive() || host.isBitwigStudio())
#endif #endif
setBounds (0, 0, w, h); setBounds (0, 0, w, h);
} }


Loading…
Cancel
Save