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

PopupMenu: Only show menus within safe areas of the screen

This change stops menus from displaying under notches/cutouts on mobile
platforms.
This commit is contained in:
reuk 2021-08-26 12:07:05 +01:00
parent f87582a013
commit ea757cf1ea
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -781,12 +781,8 @@ struct MenuWindow : public Component
if (relativeTo != nullptr)
targetPoint = relativeTo->localPointToGlobal (targetPoint);
auto parentArea = Desktop::getInstance().getDisplays().getDisplayForPoint (targetPoint * scaleFactor)
#if JUCE_MAC || JUCE_ANDROID
->userArea;
#else
->totalArea; // on windows, don't stop the menu overlapping the taskbar
#endif
auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (targetPoint * scaleFactor);
auto parentArea = display->safeAreaInsets.subtractedFrom (display->totalArea);
if (parentComponent == nullptr)
return parentArea;