Mountain Lion Login Window CGEvent fails

353 Views Asked by At

I have an app which uses CGEvent taps to catch key presses and mouse events.

Example .. CGEventTapCreate(kCGHIDEventTap, kCGTailAppendEventTap, 1, eventMask, keyUp, @"mydata");

I also generate events. Everything works fine except when this app ( PrivilegedHelperTool ) is ran as a pre login launch agent(login window). The app shows up fine but all my taps return null and my generated events don't work. Is there something else than "kCGHIDEventTap" when in pre login state?

I've gone as far as using IOKit to catch mouse movements(works), but when implementing key press it seems this IOKit stuff is deprecated and most suggestions say to use CGEvent Equivalents.

1

There are 1 best solutions below

0
On

Please check this thread

Mac event tap just delays discarded events

Your event tap should work on logon window too (even injection) but has few limitation, you can not filter the password dialog f.e (not surprisingly)