Skip to content

Commit

Permalink
macos: default Accessibility on if VoiceOver is on
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored and LibretroAdmin committed May 24, 2024
1 parent a6c82df commit 77da476
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#include "switch_performance_profiles.h"
#endif

#if IOS
#if __APPLE__
#include "ui/drivers/cocoa/apple_platform.h"
#endif

Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions ui/drivers/cocoa/apple_platform.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 8 additions & 0 deletions ui/drivers/cocoa/cocoa_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 77da476

Please sign in to comment.