diff options
author | Jesse van den Kieboom <jessevdk@gmail.com> | 2014-08-23 10:59:29 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-09-29 15:25:06 -0400 |
commit | de96cea7329fb0a9877ba9339207bd414d6e9331 (patch) | |
tree | d459bab92a02766ace185f4554dae67bfdd83fe5 | |
parent | 74e71495c2f69d197cfa3e3c594852c2e5051bd3 (diff) | |
download | gtk+-de96cea7329fb0a9877ba9339207bd414d6e9331.tar.gz |
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
-rw-r--r-- | 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 f21127e17c..a9b3b406cf 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) |