Skip to content

Commit

Permalink
Prevent unresponsive trackpad after revoking Accessibility permission
Browse files Browse the repository at this point in the history
- Use `AXIsProcessTrustedWithOptions` instead of `AXIsProcessTrusted`
- Use event tap option `.listenOnly` instead of `.default`

closes #63

Co-Authored-By: Ilya Rodionov <[email protected]>
  • Loading branch information
artginzburg and ris58h committed Mar 29, 2023
1 parent 6aa54ad commit 0d5a723
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MiddleClick/Controller.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ - (void)registerMouseCallback:(NSAutoreleasePool*)pool
// create eventTap which listens for core grpahic events with the filter
// sepcified above (so left mouse down and up again)
CFMachPortRef eventTap = CGEventTapCreate(
kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault,
kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
eventMask, mouseCallback, NULL);
currentEventTap = eventTap;

Expand Down
3 changes: 2 additions & 1 deletion MiddleClick/TrayMenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ - (id)initWithController:(Controller*)ctrl

- (void)initAccessibilityPermissionStatus:(NSMenu*)menu
{
BOOL hasAccessibilityPermission = AXIsProcessTrusted();
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
BOOL hasAccessibilityPermission = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);

[self updateAccessibilityPermissionStatus:menu
hasAccessibilityPermission:hasAccessibilityPermission];
Expand Down

0 comments on commit 0d5a723

Please sign in to comment.