Skip to content

Commit

Permalink
Apple: addeding new accessibility settings (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
pouwelsjochem committed Aug 18, 2023
1 parent d39da67 commit b82949d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions platform/iphone/Rtt_IPhonePlatformBase.mm
Expand Up @@ -17,6 +17,7 @@

#import <UIKit/UIAlertView.h>
#import <UIKit/UIAlertController.h>
#import <UIKit/UIAccessibility.h>
#import <GameController/GameController.h>

#include "Rtt_IPhonePlatformBase.h"
Expand Down Expand Up @@ -559,6 +560,27 @@ -(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)b
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "reduceMotion" ) == 0 )
{
BOOL res = UIAccessibilityIsReduceMotionEnabled();
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "reduceTransparency" ) == 0 )
{
BOOL res = UIAccessibilityIsReduceTransparencyEnabled();
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "differentiateWithoutColor" ) == 0 )
{
BOOL res = NO;
if (@available(iOS 13.0, tvOS 13.0, *)) {
res = UIAccessibilityShouldDifferentiateWithoutColor();
}
lua_pushboolean(L, res);
pushedValues = 1;
}
else
{
// Attempt to fetch the requested system info from the base class.
Expand Down
19 changes: 19 additions & 0 deletions platform/mac/Rtt_MacPlatform.mm
Expand Up @@ -49,6 +49,7 @@
#import <AppKit/NSFontManager.h>
#import <AppKit/NSOpenGL.h>
#import <AppKit/NSWindow.h>
#import <AppKit/NSWorkspace.h>
#import <Foundation/NSString.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
Expand Down Expand Up @@ -1240,6 +1241,24 @@ -(void)alertDidEnd:(NSAlert *)alertView returnCode:(NSInteger)returnCode context
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "reduceMotion" ) == 0 )
{
BOOL res = [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion];
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "reduceTransparency" ) == 0 )
{
BOOL res = [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceTransparency];
lua_pushboolean(L, res);
pushedValues = 1;
}
else if ( Rtt_StringCompare( key, "differentiateWithoutColor" ) == 0 )
{
BOOL res = [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldDifferentiateWithoutColor];
lua_pushboolean(L, res);
pushedValues = 1;
}
else
{
// Attempt to fetch the requested system info from the base class.
Expand Down

0 comments on commit b82949d

Please sign in to comment.