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:
parent
f87582a013
commit
ea757cf1ea
1 changed files with 2 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue