diff options
author | culler <culler> | 2018-10-21 21:41:34 (GMT) |
---|---|---|
committer | culler <culler> | 2018-10-21 21:41:34 (GMT) |
commit | 8ea711d0aea88cecedd9fe9f32436e376da780ee (patch) | |
tree | 64c93e8884d577522f73f6b9addda184b4044c6c /macosx/tkMacOSXDraw.c | |
parent | 56a9c541052f8779ea0124308d27a12041e7cfbe (diff) | |
download | tk-8ea711d0aea88cecedd9fe9f32436e376da780ee.zip tk-8ea711d0aea88cecedd9fe9f32436e376da780ee.tar.gz tk-8ea711d0aea88cecedd9fe9f32436e376da780ee.tar.bz2 |
Deal with Mojave deprecations and remove unneeded code.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 1e1e893..ce53a17 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -18,6 +18,12 @@ #include "tkMacOSXDebug.h" #include "tkButton.h" +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 +#define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext] +#else +#define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort] +#endif + /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_DRAWING @@ -1489,7 +1495,7 @@ TkMacOSXSetupDrawingContext( goto end; } dc.view = view; - dc.context = [[NSGraphicsContext currentContext] graphicsPort]; + dc.context = GET_CGCONTEXT; dc.portBounds = NSRectToCGRect([view bounds]); if (dc.clipRgn) { clipBounds = CGContextGetClipBoundingBox(dc.context); @@ -1658,7 +1664,7 @@ TkMacOSXGetClipRgn( TkMacOSXDbgMsg("%s", macDraw->winPtr->pathName); NSView *view = TkMacOSXDrawableView(macDraw); if ([view lockFocusIfCanDraw]) { - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef context = GET_CGCONTEXT; CGContextSaveGState(context); CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, [view bounds].size.height)); |