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

VST3: Scale the ContextMenu coords correctly in DPI-aware hosts

This commit is contained in:
ed 2019-11-29 15:15:26 +00:00
parent d00d23139c
commit a8e592d8a8

View file

@ -3026,7 +3026,19 @@ tresult VST3HostContext::ContextMenu::popup (Steinberg::UCoord x, Steinberg::UCo
PopupMenu::Options options;
if (auto* ed = owner.getActiveEditor())
{
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
if (auto* peer = ed->getPeer())
{
auto scale = peer->getPlatformScaleFactor();
x = roundToInt (x / scale);
y = roundToInt (y / scale);
}
#endif
options = options.withTargetScreenArea (ed->getScreenBounds().translated ((int) x, (int) y).withSize (1, 1));
}
#if JUCE_MODAL_LOOPS_PERMITTED
// Unfortunately, Steinberg's docs explicitly say this should be modal..