diff options
Diffstat (limited to 'src/macos.m')
-rw-r--r-- | src/macos.m | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/macos.m b/src/macos.m index 975ba928..1d972ebd 100644 --- a/src/macos.m +++ b/src/macos.m | |||
@@ -38,14 +38,25 @@ enum iTouchBarVariant { | |||
38 | default_TouchBarVariant, | 38 | default_TouchBarVariant, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static iInt2 macVer_(void) { | ||
42 | if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { | ||
43 | const NSOperatingSystemVersion ver = [[NSProcessInfo processInfo] operatingSystemVersion]; | ||
44 | return init_I2(ver.majorVersion, ver.minorVersion); | ||
45 | } | ||
46 | return init_I2(10, 10); | ||
47 | } | ||
48 | |||
41 | static NSString *currentSystemAppearance_(void) { | 49 | static NSString *currentSystemAppearance_(void) { |
42 | /* This API does not exist on 10.13. */ | 50 | /* This API does not exist on 10.13. */ |
43 | @try { | 51 | if ([NSApp respondsToSelector:@selector(effectiveAppearance)]) { |
44 | return [[NSApp effectiveAppearance] name]; | 52 | return [[NSApp effectiveAppearance] name]; |
45 | } | 53 | } |
46 | @catch (NSException *) { | 54 | return @"NSAppearanceNameAqua"; |
47 | return @"NSAppearanceNameAqua"; | 55 | } |
48 | } | 56 | |
57 | iBool shouldDefaultToMetalRenderer_MacOS(void) { | ||
58 | const iInt2 ver = macVer_(); | ||
59 | return ver.x > 10 || ver.y > 13; | ||
49 | } | 60 | } |
50 | 61 | ||
51 | /*----------------------------------------------------------------------------------------------*/ | 62 | /*----------------------------------------------------------------------------------------------*/ |