Merge pull request #3040 from theojulienne/accessibility-fixes
Fix Text to Speech on OS X 10.11
This commit is contained in:
commit
922fce1892
2 changed files with 11 additions and 2 deletions
|
@ -43,11 +43,20 @@
|
||||||
atom::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
|
atom::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (bool)voiceOverEnabled {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults addSuiteNamed:@"com.apple.universalaccess"];
|
||||||
|
[defaults synchronize];
|
||||||
|
|
||||||
|
return [defaults boolForKey:@"voiceOverOnOffKey"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
|
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
|
||||||
// Undocumented attribute that VoiceOver happens to set while running.
|
// Undocumented attribute that VoiceOver happens to set while running.
|
||||||
// Chromium uses this too, even though it's not exactly right.
|
// Chromium uses this too, even though it's not exactly right.
|
||||||
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
|
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
|
||||||
[self updateAccessibilityEnabled:[value boolValue]];
|
bool enableAccessibility = ([self voiceOverEnabled] && [value boolValue]);
|
||||||
|
[self updateAccessibilityEnabled:enableAccessibility];
|
||||||
}
|
}
|
||||||
return [super accessibilitySetValue:value forAttribute:attribute];
|
return [super accessibilitySetValue:value forAttribute:attribute];
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ void ShowItemInFolder(const base::FilePath& full_path) {
|
||||||
DCHECK([NSThread isMainThread]);
|
DCHECK([NSThread isMainThread]);
|
||||||
NSString* path_string = base::SysUTF8ToNSString(full_path.value());
|
NSString* path_string = base::SysUTF8ToNSString(full_path.value());
|
||||||
if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string
|
if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string
|
||||||
inFileViewerRootedAtPath:nil])
|
inFileViewerRootedAtPath:@""])
|
||||||
LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value();
|
LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue