Guard Cocoa system appearance observation in ifdefs for MacOS 10.14+

NSAppearanceName constants have various OS constraints, and so require more thorough checks.
This commit is contained in:
ws909 2023-01-26 02:30:27 +01:00
parent b091cc0c80
commit 5ee6c4526d

View File

@ -448,6 +448,7 @@ static GLFWbool initializeTIS(void)
_glfwInputSystemTheme(NULL); _glfwInputSystemTheme(NULL);
}*/ }*/
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- (void)observeValueForKeyPath:(NSString *)keyPath - (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object ofObject:(id)object
change:(NSDictionary *)change change:(NSDictionary *)change
@ -472,6 +473,7 @@ static GLFWbool initializeTIS(void)
[self accentColorChanged]; [self accentColorChanged];
}*/ }*/
} }
#endif
@end // GLFWHelper @end // GLFWHelper
@ -734,10 +736,12 @@ int _glfwInitCocoa(void)
context:nil]; context:nil];
*/ */
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
[NSApp addObserver:_glfw.ns.helper [NSApp addObserver:_glfw.ns.helper
forKeyPath:@"effectiveAppearance" forKeyPath:@"effectiveAppearance"
options:0 options:0
context:nil]; context:nil];
#endif
if (![[NSRunningApplication currentApplication] isFinishedLaunching]) if (![[NSRunningApplication currentApplication] isFinishedLaunching])
[NSApp run]; [NSApp run];