macos: default Accessibility on if VoiceOver is on

This commit is contained in:
Eric Warmenhoven 2024-05-23 21:30:45 -04:00 committed by LibretroAdmin
parent a6c82df0fd
commit 77da47613e
3 changed files with 10 additions and 5 deletions

View File

@ -70,7 +70,7 @@
#include "switch_performance_profiles.h"
#endif
#if IOS
#if __APPLE__
#include "ui/drivers/cocoa/apple_platform.h"
#endif
@ -2880,7 +2880,7 @@ void config_set_defaults(void *data)
load_timezone(settings->arrays.timezone);
#endif
#if IOS
#if __APPLE__
configuration_set_bool(settings,
settings->bools.accessibility_enable, RAIsVoiceOverRunning());
#endif

View File

@ -1,10 +1,7 @@
#ifndef COCOA_APPLE_PLATFORM_H
#define COCOA_APPLE_PLATFORM_H
#if TARGET_OS_IPHONE
/* this comes from UIKit but you cannot #include UIKit from C */
extern bool RAIsVoiceOverRunning(void);
#endif
#if TARGET_OS_TV
#include "config_file.h"

View File

@ -62,6 +62,14 @@ extern bool RAIsVoiceOverRunning(void)
{
return UIAccessibilityIsVoiceOverRunning();
}
#elif OSX
#import <AppKit/AppKit.h>
extern bool RAIsVoiceOverRunning(void)
{
if (@available(macOS 10.13, *))
return [[NSWorkspace sharedWorkspace] isVoiceOverEnabled];
return false;
}
#endif
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)