From 89f07ed390b0586f0b34e6c3b1fca19bd3db4d07 Mon Sep 17 00:00:00 2001 From: Pedro Beirao <82064173+Pedro-Beirao@users.noreply.github.com> Date: Tue, 19 Dec 2023 05:47:55 +0000 Subject: [PATCH] Request Accessibility Permissions on Mac (#1628) --- src/Application/App.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Application/App.cpp b/src/Application/App.cpp index 6c688414c..6f32061f7 100644 --- a/src/Application/App.cpp +++ b/src/Application/App.cpp @@ -62,6 +62,9 @@ #include "Utility/Tokenizer.h" #include #include +#ifdef __WXOSX__ + #include +#endif using namespace slade; @@ -574,6 +577,20 @@ bool app::init(const vector& args, double ui_scale) maineditor::windowWx()->Refresh(); } + // Show Accessibility Pop-Up on Mac if needed + #ifdef __WXOSX__ + CFStringRef keys[] = { kAXTrustedCheckOptionPrompt }; + CFTypeRef values[] = { kCFBooleanTrue }; + CFDictionaryRef options = CFDictionaryCreate(NULL, + (const void **)&keys, + (const void **)&values, + sizeof(keys) / sizeof(keys[0]), + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + if(AXIsProcessTrustedWithOptions(options)) + CFRelease(options); + #endif + return true; }