aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm21
1 files changed, 12 insertions, 9 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 7f26f4bb0..50e42f38e 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1986,6 +1986,11 @@ void ListBoxImpl::Create(Window & /*parent*/, int /*ctrlID*/, Scintilla::Point p
table.target = ds;
table.doubleAction = @selector(doubleClick:);
table.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList;
+
+ if (@available(macOS 11.0, *)) {
+ [table setStyle: NSTableViewStylePlain];
+ }
+
wid = (__bridge_retained WindowID)winLB;
}
@@ -2016,8 +2021,13 @@ PRectangle ListBoxImpl::GetDesiredRect() {
PRectangle rcDesired;
rcDesired = GetPosition();
- // There appears to be an extra pixel above and below the row contents
- CGFloat itemHeight = table.rowHeight + 2;
+ CGFloat itemHeight;
+ if (@available(macOS 11.0, *)) {
+ itemHeight = table.rowHeight;
+ } else {
+ // There appears to be an extra pixel above and below the row contents
+ itemHeight = table.rowHeight + 2;
+ }
int rows = Length();
if ((rows == 0) || (rows > desiredVisibleRows))
@@ -2027,13 +2037,6 @@ PRectangle ListBoxImpl::GetDesiredRect() {
rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth;
rcDesired.right += 4; // Ensures no truncation of text
- if (@available(macOS 11, *)) {
- // macOS 11 requires some extra space possibly due to the rounded highlight.
- // There may be a better way to discover how much space is required
- // but an extra 22 pixels fixes it for almost all tested cases.
- rcDesired.right += 22;
- }
-
if (Length() > rows) {
[scroller setHasVerticalScroller: YES];
rcDesired.right += [NSScroller scrollerWidthForControlSize: NSControlSizeRegular