Skip to content

Commit

Permalink
fix: consider dock space when showing menu (#35194)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Aug 3, 2022
1 parent 7b8fb2b commit afa4f50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shell/browser/api/electron_api_menu_mac.mm
Expand Up @@ -131,7 +131,7 @@
if (!item) {
CGFloat windowBottom = CGRectGetMinY([view window].frame);
CGFloat lowestMenuPoint = windowBottom + position.y - [menu size].height;
CGFloat screenBottom = CGRectGetMinY([view window].screen.frame);
CGFloat screenBottom = CGRectGetMinY([view window].screen.visibleFrame);
CGFloat distanceFromBottom = lowestMenuPoint - screenBottom;
if (distanceFromBottom < 0)
position.y = position.y - distanceFromBottom + 4;
Expand All @@ -140,7 +140,7 @@
// Place the menu left of cursor if it is overflowing off right of screen.
CGFloat windowLeft = CGRectGetMinX([view window].frame);
CGFloat rightmostMenuPoint = windowLeft + position.x + [menu size].width;
CGFloat screenRight = CGRectGetMaxX([view window].screen.frame);
CGFloat screenRight = CGRectGetMaxX([view window].screen.visibleFrame);
if (rightmostMenuPoint > screenRight)
position.x = position.x - [menu size].width;

Expand Down

0 comments on commit afa4f50

Please sign in to comment.