I have setup global keyboard trap using following code:
self.machPortRef = CGEventTapCreate(kCGSessionEventTap,
kCGTailAppendEventTap,
kCGEventTapOptionDefault,
CGEventMaskBit(kCGEventKeyUp),
(CGEventTapCallBack)eventTapFunction,
self);
How can i block/redirect keydown events of front most active window in my cocoa app. I tried to return NULL in eventTapFunction, but it didn’t block the event.
Thanks,
Subclass
NSApplication, and override-sendEvent: