Mercurial > osx-quasimode
view TestQuasimodalEventTap.m @ 24:f2f634d576cf
quasimodal events now propogate to JS.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Mon, 12 Apr 2010 01:40:16 -0700 |
parents | ddc7cc16c48c |
children | c3e5b6b3bb4b |
line wrap: on
line source
#import <Foundation/NSString.h> #import <Foundation/NSKeyValueCoding.h> #import <Foundation/NSAutoreleasePool.h> #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; }