Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
fix: consider dock space when showing menu (electron#35194)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz authored and khalwa committed Feb 22, 2023
1 parent 21a127b commit 9824001
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 9824001

Please sign in to comment.