From 4f9d5c47a0d6e1cfa984d846b0470b3f9839e5fd Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig Date: Tue, 31 Jul 2018 14:52:47 +0200 Subject: [PATCH] Use custom text bg color for HighSierra+ --- darwin/future.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/darwin/future.m b/darwin/future.m index e6d05ef4..5b64b0a6 100644 --- a/darwin/future.m +++ b/darwin/future.m @@ -11,6 +11,8 @@ CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue = NULL; // added in OS X 10.12; we need 10.8 CFStringRef *uiprivFUTURE_kCTBackgroundColorAttributeName = NULL; +NSOperatingSystemVersion HIGH_SIERRA_VERSION = { .majorVersion = 10, .minorVersion = 13, .patchVersion = 0 }; + // note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed) void uiprivLoadFutures(void) { @@ -23,7 +25,9 @@ void uiprivLoadFutures(void) #define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn) GET(uiprivFUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag); GET(uiprivFUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue); - GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName); + if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:HIGH_SIERRA_VERSION]) + GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName); + dlclose(handle); }