SKID is a Mac OS X preference panel that allows applications of your choosing to receive function key and mouse presses when your program is in the foreground instead of those events being consumed by the system.
SKID was initially developed years ago as a CS project for a University class I was in. Its pretty useful so I am posting it here as free open source software, though it needs to be cleaned up quite a bit to be buildable again.
the method I used to intercept events (CGEventTap) does not seem to work for getting mouse events from some applications (OpenGL?, carbon?) which is a real shame becasue the primary inspiration was to be able to use all my mouse buttons in Team Fortress 2 without having to disable exposé...