macOS 10.15: Request screen reader permission for AutoType

* Fix #3609 - Request screen reader permission by faking a 1px screenshot. Thanks to MacPass for this idea.
* Fix #3578 - Remove duplicate sandbox entitlement
* Fix #3270 - Use executable path reference for libquazip
This commit is contained in:
Jonathan White 2019-10-13 21:59:10 -04:00
parent dbe15d32e5
commit e50261a99c
3 changed files with 13 additions and 2 deletions

View File

@ -8,8 +8,6 @@
<string>production</string>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.print</key>
<true/>
<key>com.apple.security.app-sandbox</key>

View File

@ -105,6 +105,8 @@ if(APPLE AND WITH_APP_BUNDLE)
"@executable_path/../Frameworks/libyubikey.0.dylib"
-change /usr/local/opt/ykpers/lib/libykpers-1.1.dylib
"@executable_path/../Frameworks/libykpers-1.1.dylib"
-change /usr/local/opt/quazip/lib/libquazip.1.dylib
"@executable_path/../Frameworks/libquazip.1.dylib"
keepassxc-cli
COMMENT "Changing linking of keepassxc-cli")

View File

@ -144,6 +144,17 @@ static const NSEventMask NSEventMaskKeyDown = NSKeyDownMask;
//
- (bool) enableAccessibility
{
// Request a 1 pixel screenshot to trigger the permissions
// required for screen reader access. These are necessary
// for Auto-Type to find the window titles in macOS 10.15+
CGImageRef screenshot = CGWindowListCreateImage(
CGRectMake(0, 0, 1, 1),
kCGWindowListOptionOnScreenOnly,
kCGNullWindowID,
kCGWindowImageDefault);
CFRelease(screenshot);
// Request accessibility permissions for Auto-Type type on behalf of the user
NSDictionary* opts = @{static_cast<id>(kAXTrustedCheckOptionPrompt): @YES};
return AXIsProcessTrustedWithOptions(static_cast<CFDictionaryRef>(opts));
}