Does anyone know how to catch events in Mac OS X ? My problem is that I need to intercept for example a MOUSEKEYDOWN or maybe a KEYSTROKE before the event arrives to any application. My objective is to block the event or change the data it could contain. I read something about the kEvent class but I could not find some sample to understand how to begin programming with it.

2 Answers

Try Quartz Event Taps. You can explore how they work with Event Taps Testbench or read the documentation.

0

As far as I know you can use the Carbon API to register to events and modify them. Modifying the event is not possible if you use Cocoa, i.e. the NSEvent class, which can only be observed. I used this tutorial to get started with the Carbon API myself. I found it really hard to find any tutorials not using Cocoa, so I hope that helps.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.