The attached project illustrates two things.

First, it demonstrates how to use event taps, a mechanism under Mac OS X that allows the monitoring and manipulation of system events before they get posted to an application by the window server.

It also demonstrates how this monitoring feature can be used to read out touches on the Magic Trackpad/the MacBook touch pad and get absolute coordinates from these events. Technically those events should contain the same rich information that you can get by using this method, but I don't know how and where this info is saved in the CGEvents.

Also keep in mind that while not using reverse engineered headers or linking to private frameworks directly, dealing with touch events on this level is kind of hacky at the moment (Mac OS X Snow Leopard). You can clearly see how the different event types (Cocoa level, i.e. NSEvent, and Core Level, i.e. CGEvent) work together, but it's not well documented by Apple so far.

All other information is supplied in the demo code, if you have any questions, ask Gero.

Demo code for event taps and touch visualization a compiled binary of the TPEV
Attachments:
File Description File size Downloads Last modified
TouchPadEventVisualizer.zip Demo code for event taps and touch visualization 211 kB 391 2011-04-15 11:57
TPEV_binary.zip a compiled binary of the TPEV 215 kB 426 2011-04-15 12:00

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.