mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
VST: Resize host window when global scale factor is changed
This commit is contained in:
parent
7372531964
commit
fb030ade16
2 changed files with 24 additions and 12 deletions
|
|
@ -1126,23 +1126,21 @@ public:
|
|||
|
||||
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())
|
||||
{
|
||||
ed->setTopLeftPosition (0, 0);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
updateWindowSize (false);
|
||||
}
|
||||
|
|
@ -1153,6 +1151,11 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
void parentSizeChanged() override
|
||||
{
|
||||
updateWindowSize (true);
|
||||
}
|
||||
|
||||
void childBoundsChanged (Component*) override
|
||||
{
|
||||
updateWindowSize (false);
|
||||
|
|
|
|||
|
|
@ -1452,6 +1452,15 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void parentSizeChanged() override
|
||||
{
|
||||
if (pluginEditor != nullptr)
|
||||
{
|
||||
resizeHostWindow();
|
||||
pluginEditor->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void resizeHostWindow()
|
||||
{
|
||||
if (pluginEditor != nullptr)
|
||||
|
|
@ -1477,7 +1486,7 @@ private:
|
|||
#if JUCE_MAC
|
||||
if (host.isWavelab() || host.isReaper())
|
||||
#else
|
||||
if (host.isWavelab() || host.isAbletonLive())
|
||||
if (host.isWavelab() || host.isAbletonLive() || host.isBitwigStudio())
|
||||
#endif
|
||||
setBounds (0, 0, w, h);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue