It's conceivable that System Settings > Privacy & Security > Accessibility could be needed. Try calling CGRequestListenEventAccess, which may result in a prompt to add some permission in System Settings.
Topic:
App & System Services
SubTopic:
Core OS
Tags: