Skip to content

Commit 16f614a

Browse files
authored
GH485 (#486)
* Clamping of the command popover position now takes into account the screen frame, not just the screen width. fixed #485 * clang-format
1 parent c1f5e95 commit 16f614a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Source/CUI/source/CommandPopover.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,11 +1045,12 @@ - (void)showRelativeToRect:(NSRect)_positioning_rect
10451045
}();
10461046
const double y = NSMinY(rect_on_screen) - m_ContentSize.height;
10471047
NSScreen *screen = _positioning_view.window.screen;
1048+
const NSRect screen_rect = screen.visibleFrame;
10481049
const double x = [&] {
1049-
if( initial_x < 0. )
1050-
return 0.;
1051-
else if( initial_x + sx > screen.frame.size.width )
1052-
return screen.frame.size.width - sx;
1050+
if( initial_x < screen_rect.origin.x )
1051+
return screen_rect.origin.x;
1052+
else if( initial_x + sx > NSMaxX(screen_rect) )
1053+
return NSMaxX(screen_rect) - sx;
10531054
else
10541055
return initial_x;
10551056
}();

0 commit comments

Comments
 (0)