diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-27 14:44:43 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-27 14:44:55 +0300 |
commit | 25c5dccac8d31febaae263befafe6d50d8660342 (patch) | |
tree | 46e9c4a44162ce101a87f990300020c4183c7bd0 /src/macos.m | |
parent | 8afa95b0183d041ff90ad2f49805540fe8bd8cba (diff) |
macOS: 10.13 should use OpenGL renderer
There appears to be a problem with SDL's Metal renderer under 10.13 (segfault on window creation).
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 | /*----------------------------------------------------------------------------------------------*/ |