1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

VST: Use ComponentPeer::getAreaCoveredBy() to get scaled editor bounds on Windows and Linux

This commit is contained in:
ed 2021-03-05 18:04:02 +00:00
parent 7b68d5fa4b
commit 655a6e9367

View file

@ -2851,38 +2851,30 @@ public:
if (recursiveResize)
return;
auto* topComp = getTopLevelComponent();
if (topComp->getPeer() != nullptr)
if (auto* peer = getTopLevelComponent()->getPeer())
{
auto pos = (topComp->getLocalPoint (this, Point<int>()) * nativeScaleFactor).roundToInt();
const ScopedValueSetter<bool> recursiveResizeSetter (recursiveResize, true);
recursiveResize = true;
auto pos = (peer->getAreaCoveredBy (*this).toFloat() * nativeScaleFactor).toNearestInt();
#if JUCE_WINDOWS
if (pluginHWND != 0)
{
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND };
MoveWindow (pluginHWND, pos.getX(), pos.getY(),
roundToInt (getWidth() * nativeScaleFactor),
roundToInt (getHeight() * nativeScaleFactor),
TRUE);
MoveWindow (pluginHWND, pos.getX(), pos.getY(), pos.getWidth(), pos.getHeight(), TRUE);
}
#elif JUCE_LINUX
if (pluginWindow != 0)
{
X11Symbols::getInstance()->xMoveResizeWindow (display, pluginWindow,
pos.getX(), pos.getY(),
static_cast<unsigned int> (roundToInt ((float) getWidth() * nativeScaleFactor)),
static_cast<unsigned int> (roundToInt ((float) getHeight() * nativeScaleFactor)));
(unsigned int) pos.getWidth(),
(unsigned int) pos.getHeight());
X11Symbols::getInstance()->xMapRaised (display, pluginWindow);
X11Symbols::getInstance()->xFlush (display);
}
#endif
recursiveResize = false;
}
}