Skip to content

Commit

Permalink
fix: consider dock space when showing menu (#35199)
Browse files Browse the repository at this point in the history
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
  • Loading branch information
trop[bot] and zcbenz committed Aug 3, 2022
1 parent 0068195 commit 67a40dd
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 @@ -134,7 +134,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 @@ -143,7 +143,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 67a40dd

Please sign in to comment.