Skip to content

Backport PR #17956 on branch v3.3.x (ENH: Add version check for mac sdk version) #18067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ def get_extensions(self):
'src/_macosx.m'
]
ext = Extension('matplotlib.backends._macosx', sources)
ext.extra_compile_args.extend(['-Werror=unguarded-availability'])
ext.extra_link_args.extend(['-framework', 'Cocoa'])
if platform.python_implementation().lower() == 'pypy':
ext.extra_compile_args.append('-DPYPY=1')
Expand Down
6 changes: 4 additions & 2 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -1207,8 +1207,10 @@ -(void)save_figure:(id)sender
rect.size.height = 0;
rect.origin.x += height;
NSTextView* messagebox = [[NSTextView alloc] initWithFrame: rect];
messagebox.textContainer.maximumNumberOfLines = 2;
messagebox.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
if (@available(macOS 10.11, *)) {
messagebox.textContainer.maximumNumberOfLines = 2;
messagebox.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
}
[messagebox setFont: font];
[messagebox setDrawsBackground: NO];
[messagebox setSelectable: NO];
Expand Down