Browse Source

PopupMenu: Only show menus within safe areas of the screen

This change stops menus from displaying under notches/cutouts on mobile
platforms.
v6.1.6
reuk 3 years ago
parent
commit
ea757cf1ea
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 2 additions and 6 deletions
  1. +2
    -6
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp

+ 2
- 6
modules/juce_gui_basics/menus/juce_PopupMenu.cpp 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;


Loading…
Cancel
Save