[gtk/wip/fanc999/gtk-3-24-meson-msvc: 45/297] Add compile-time check for NSGraphicsContext graphicsPort/CGContext.



commit de3b91da82373c03422528d92ab6ef032c44ab22
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]