[gtk/gtk-3-24: 12/20] Add compile-time check for NSGraphicsContext	graphicsPort/CGContext.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gtk/gtk-3-24: 12/20] Add compile-time check for NSGraphicsContext	graphicsPort/CGContext.
- Date: Sat,  8 Dec 2018 19:43:37 +0000 (UTC)
commit ca6db9a79da13a7329c1e97e1334421418a58630
Author: John Ralls <jralls ceridwen us>
Date:   Fri Nov 23 09:46:28 2018 +0900
    Add compile-time check for NSGraphicsContext graphicsPort/CGContext.
    
    Runtime check alone doesn't silence warning.
 gdk/quartz/gdkwindow-quartz.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 1d200ecab9..47857156e8 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -141,7 +141,7 @@ static CGContextRef
 gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
                                    gboolean             antialias)
 {
-  CGContextRef cg_context;
+  CGContextRef cg_context = NULL;
   CGSize scale;
 
   if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
@@ -158,10 +158,15 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
       if (![window_impl->view lockFocusIfCanDraw])
         return NULL;
     }
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
+    cg_context = [[NSGraphicsContext currentContext] graphicsPort];
+#else
   if (gdk_quartz_osx_version () < GDK_OSX_YOSEMITE)
     cg_context = [[NSGraphicsContext currentContext] graphicsPort];
   else
     cg_context = [[NSGraphicsContext currentContext] CGContext];
+#endif
+
   if (!cg_context)
     return NULL;
   CGContextSaveGState (cg_context);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]