[gtk+] quartz: Add availability check for >= 10.7 API



commit de96cea7329fb0a9877ba9339207bd414d6e9331
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Aug 23 10:59:29 2014 +0200

    quartz: Add availability check for >= 10.7 API
    
    This adds both a compile time check for the SDK version being
    compiled against, as well as a runtime check in the case the
    resulting binary is run against an older SDK.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735054

 gtk/gtkapplication-quartz-menu.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkapplication-quartz-menu.c b/gtk/gtkapplication-quartz-menu.c
index f21127e..a9b3b40 100644
--- a/gtk/gtkapplication-quartz-menu.c
+++ b/gtk/gtkapplication-quartz-menu.c
@@ -249,7 +249,7 @@ icon_loaded (GObject      *object,
 
       GtkIconTheme *theme;
       GtkIconInfo *info;
-      gint scale;
+      gint scale = 1;
 
       if (!parsed)
         {
@@ -262,7 +262,14 @@ icon_loaded (GObject      *object,
         }
 
       theme = gtk_icon_theme_get_default ();
-      scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
+
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+       /* we need a run-time check for the backingScaleFactor selector because we
+        * may be compiling on a 10.7 framework, but targeting a 10.6 one
+        */
+      if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
+        scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
+#endif
       info = gtk_icon_theme_lookup_by_gicon_for_scale (theme, icon, ICON_SIZE, scale, 
GTK_ICON_LOOKUP_USE_BUILTIN);
 
       if (info != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]