summaryrefslogtreecommitdiff
path: root/src/macos.m
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-27 14:44:43 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-27 14:44:55 +0300
commit25c5dccac8d31febaae263befafe6d50d8660342 (patch)
tree46e9c4a44162ce101a87f990300020c4183c7bd0 /src/macos.m
parent8afa95b0183d041ff90ad2f49805540fe8bd8cba (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.m19
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
41static 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
41static NSString *currentSystemAppearance_(void) { 49static 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
57iBool shouldDefaultToMetalRenderer_MacOS(void) {
58 const iInt2 ver = macVer_();
59 return ver.x > 10 || ver.y > 13;
49} 60}
50 61
51/*----------------------------------------------------------------------------------------------*/ 62/*----------------------------------------------------------------------------------------------*/