I'm interested in writing an application that will intercept keyboard & mouse events, and will then be able to generate new keyboard & mouse events based upon what it observes. For example, adding gesture recognition to my iBook's touchpad: when the Control key (or some other hot key) is pressed down, I'd like certain mouse gestures to generate GUI events such as key presses, etc. Maybe even extend it to something similar to Graffiti on Palm Pilots. I don't want this to be limited to a single application, but I'd like the gestures to work while I'm running any arbitrary app. I'm hoping this will allow me to extend the abilities of my iBook's built in trackpad.
I've seen that bits & pieces of this can be done. Gamepad Companion will generate keyboard and mouse events based upon USB gamepad input, so event generation is at least possible (I suspect via a CoreGraphics method). What I don't know how to do is intercept keyboard & mouse events. Ideally I could somehow hook myself into the event processing chain, and choose to filter out events when I desire (like filtering out mouse movement while the hotkey is pressed). However, I'd settle for just being able to observe them. I've seen discussion of NSEvent stuff, but that seems to only allow overriding the behavior within an individual app or widget, not allow me to watch events globally.