Skip to content

Add minimum macosx version #22240

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
merged 2 commits into from
Feb 17, 2022
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 .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
runs-on: ${{ matrix.os }}
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
MACOSX_DEPLOYMENT_TARGET: "10.12"
strategy:
matrix:
os: [ubuntu-18.04, windows-latest, macos-10.15]
Expand Down
1 change: 1 addition & 0 deletions doc/devel/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and the capabilities they provide.
* pycairo_ (>= 1.11.0) or cairocffi_ (>= 0.8): for the GTK and/or cairo-based
backends.
* Tornado_ (>=5): for the WebAgg backend.
* macOS (>=10.12): for the macosx backend.

.. _Tk: https://docs.python.org/3/library/tk.html
.. _PyQt5: https://pypi.org/project/PyQt5/
Expand Down
3 changes: 3 additions & 0 deletions doc/users/next_whats_new/min_macos_version.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
New minimum macOS version
-------------------------
The macosx backend now requires macOS >= 10.12.
41 changes: 3 additions & 38 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,9 @@

/* Proper way to check for the OS X version we are compiling for, from
* https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html
*/
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#define COMPILING_FOR_10_7
#endif

/* Renamed symbols cause deprecation warnings, so define macros for the new
* Renamed symbols cause deprecation warnings, so define macros for the new
* names if we are compiling on an older SDK */
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
#define NSModalResponseOK NSOKButton
#endif
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#define NSEventMaskAny NSAnyEventMask
#define NSEventTypeApplicationDefined NSApplicationDefined
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagShift NSShiftKeyMask
#define NSEventTypeKeyUp NSKeyUp
#define NSEventTypeKeyDown NSKeyDown
#define NSEventTypeMouseMoved NSMouseMoved
#define NSEventTypeLeftMouseDown NSLeftMouseDown
#define NSEventTypeRightMouseDown NSRightMouseDown
#define NSEventTypeOtherMouseDown NSOtherMouseDown
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
#define NSEventTypeRightMouseDragged NSRightMouseDragged
#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
#define NSEventTypeLeftMouseUp NSLeftMouseUp
#define NSEventTypeRightMouseUp NSRightMouseUp
#define NSEventTypeOtherMouseUp NSOtherMouseUp
#define NSWindowStyleMaskClosable NSClosableWindowMask
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
#define NSWindowStyleMaskResizable NSResizableWindowMask
#define NSWindowStyleMaskTitled NSTitledWindowMask
#endif
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101400
#define NSButtonTypeMomentaryLight NSMomentaryLightButton
#define NSButtonTypePushOnPushOff NSPushOnPushOffButton
Expand Down Expand Up @@ -895,9 +864,7 @@ -(void)save_figure:(id)sender { gil_call_method(toolbar, "save_figure"); }
NSSize scale;

rect = NSMakeRect(0, 0, imagesize, imagesize);
#ifdef COMPILING_FOR_10_7
rect = [window convertRectToBacking: rect];
#endif
size = rect.size;
scale = NSMakeSize(imagesize / size.width, imagesize / size.height);

Expand Down Expand Up @@ -934,10 +901,8 @@ -(void)save_figure:(id)sender { gil_call_method(toolbar, "save_figure"); }
rect.size.height = 0;
rect.origin.x += height;
NSTextView* messagebox = [[NSTextView alloc] initWithFrame: rect];
if (@available(macOS 10.11, *)) {
messagebox.textContainer.maximumNumberOfLines = 2;
messagebox.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
}
messagebox.textContainer.maximumNumberOfLines = 2;
messagebox.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
[messagebox setFont: font];
[messagebox setDrawsBackground: NO];
[messagebox setSelectable: NO];
Expand Down