#import #import #import #import "QuasimodalEventTap.h" @interface TestObserver : NSObject { } - onEvent:(NSNotification *)notification; @end @implementation TestObserver - onEvent:(NSNotification *)notification { NSString *type = [[notification userInfo] valueForKey: @"type"]; printf("QuasimodeEvent type=%s\n", [type UTF8String]); } @end int main(int argc, const char *argv[] ) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; QuasimodalEventTap *eventTap = [[QuasimodalEventTap alloc] initWithName: @"test" quasimodeKey: kCGEventFlagMaskAlternate]; TestObserver *observer = [[TestObserver alloc] init]; [[NSNotificationCenter defaultCenter] addObserver: observer selector: @selector(onEvent:) name: @"QuasimodeEvent" object: @"test"]; CFRunLoopRun(); [pool release]; return 0; }