Skip to content

Commit

Permalink
Request Accessibility Permissions on Mac (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro-Beirao authored Dec 19, 2023
1 parent fd80652 commit 89f07ed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Application/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
#include "Utility/Tokenizer.h"
#include <dumb.h>
#include <filesystem>
#ifdef __WXOSX__
#include <ApplicationServices/ApplicationServices.h>
#endif

using namespace slade;

Expand Down Expand Up @@ -574,6 +577,20 @@ bool app::init(const vector<string>& 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;
}

Expand Down

0 comments on commit 89f07ed

Please sign in to comment.