Updated accessibility check logic to fix Mojave crash
This commit is contained in:
parent
2d07ea716a
commit
0b54e1ff0b
@ -24,6 +24,7 @@
|
|||||||
#include <AppKit/NSWorkspace.h>
|
#include <AppKit/NSWorkspace.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <IOKit/hidsystem/ev_keymap.h>
|
#include <IOKit/hidsystem/ev_keymap.h>
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@ -128,7 +129,14 @@ bool MacGlobalShortcutBackend::KeyPressed(const QKeySequence& sequence) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const {
|
bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const {
|
||||||
return AXAPIEnabled();
|
bool accessibilityEnabled;
|
||||||
|
try{
|
||||||
|
accessibilityEnabled = AXAPIEnabled();
|
||||||
|
}catch(...){
|
||||||
|
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
|
||||||
|
accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
|
||||||
|
}
|
||||||
|
return accessibilityEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacGlobalShortcutBackend::ShowAccessibilityDialog() {
|
void MacGlobalShortcutBackend::ShowAccessibilityDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user