mtExtraButtons icon indicating copy to clipboard operation
mtExtraButtons copied to clipboard

Mac OS 10.14.4 restricts CGEventTapCreate

Open kdemarest opened this issue 6 years ago • 3 comments

I really, really want this beautiful fix you made, but when compile and run it in 10.14.4 it always returns with "Failed to create event tap"

I have visited System Prefs / Security & Privacy / Accessibility and added the compiled executable into the control list. Also, each time I recompiled I re-added the app, because the signature might change. Just to be sure.

Also, I have been running the executable as sudo, to make sure it had maximum privileges. Doesn't seem to help. A post seems to say that an Info.plist file is required, but I'm just not a Mac programmer so I don't know how to add one to a pure C program to try to make a fix. Here is the post: https://forums.developer.apple.com/thread/109283

Here is the failing code. I have tried changing the eventMask to be just the scroll wheel, but that didn't help.

eventTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0, eventMask, myCGEventCallback, NULL);

if (!eventTap) {
    fprintf(stderr, "Failed to create event tap\n");
    exit(1);
}

kdemarest avatar May 27 '19 19:05 kdemarest

Ouch, I still haven't switched to Mojave :( I guess I would have run into this problem pretty soon, thanks for letting me know. I will leave this issue open until I get a chance to look into it, so you get a notification when it is updated.

macegr avatar May 29 '19 03:05 macegr

I'm also on 10.14 and I'd very much like to try that fix... Getting the "Failed to create event tap" error as well.

ohuf avatar Apr 18 '20 22:04 ohuf

Strangely, I have been using it on 10.15 with no problems....it was still the one compiled on an earlier OS though. Will need to try it compiled on a newer OS

macegr avatar Jan 16 '21 21:01 macegr