# HG changeset patch # User Atul Varma # Date 1271058963 25200 # Node ID ddc7cc16c48c124714c7ba089a835d9f97935e74 # Parent cdc615772d43c8e066b31685307bae60b678224b added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector. diff -r cdc615772d43 -r ddc7cc16c48c QuasimodalEventTap.h --- a/QuasimodalEventTap.h Mon Apr 12 00:43:20 2010 -0700 +++ b/QuasimodalEventTap.h Mon Apr 12 00:56:03 2010 -0700 @@ -9,10 +9,12 @@ CFRunLoopSourceRef rlSrcRef; CFMachPortRef portRef; CGKeyCode lastQuasimodalKeyCode; + CGEventFlags quasimodeKey; CGEventFlags lastQuasimodalKeyFlags; int numQuasimodalKeyDowns; BOOL inQuasimode; } -- (id)initWithName:(NSString *)objectName; +- (id)initWithName:(NSString *)objectName + quasimodeKey:(CGEventFlags)key; - (void)finalize; @end diff -r cdc615772d43 -r ddc7cc16c48c QuasimodalEventTap.m --- a/QuasimodalEventTap.m Mon Apr 12 00:43:20 2010 -0700 +++ b/QuasimodalEventTap.m Mon Apr 12 00:56:03 2010 -0700 @@ -6,7 +6,6 @@ #import "QuasimodalEventTap.h" -#define QUASIMODE_KEY kCGEventFlagMaskAlternate #define MAX_STR_LEN 10 #ifdef DEBUG @@ -36,7 +35,7 @@ CGEventFlags flags = CGEventGetFlags(event); if (inQuasimode) { - if (!(flags & QUASIMODE_KEY)) { + if (!(flags & quasimodeKey)) { NSArray *keys = [NSArray arrayWithObjects: @"type", nil]; NSArray *values = [NSArray arrayWithObjects: @"quasimodeEnd", nil]; NSDictionary *dict = [NSDictionary dictionaryWithObjects: values @@ -76,7 +75,7 @@ DEBUG_MSG("Exit quasimode\n"); } } else { - if (flags & QUASIMODE_KEY) { + if (flags & quasimodeKey) { NSArray *keys = [NSArray arrayWithObjects: @"type", nil]; NSArray *values = [NSArray arrayWithObjects: @"quasimodeStart", nil]; NSDictionary *dict = [NSDictionary dictionaryWithObjects: values @@ -148,8 +147,9 @@ return NULL; } -- (id)initWithName:(NSString *)objectName { +- (id)initWithName:(NSString *)objectName quasimodeKey:(CGEventFlags)key { if (self = [super init]) { + quasimodeKey = key; numQuasimodalKeyDowns = 0; inQuasimode = NO; diff -r cdc615772d43 -r ddc7cc16c48c TestQuasimodalEventTap.m --- a/TestQuasimodalEventTap.m Mon Apr 12 00:43:20 2010 -0700 +++ b/TestQuasimodalEventTap.m Mon Apr 12 00:56:03 2010 -0700 @@ -21,7 +21,8 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; QuasimodalEventTap *eventTap = [[QuasimodalEventTap alloc] - initWithName: @"test"]; + initWithName: @"test" + quasimodeKey: kCGEventFlagMaskAlternate]; TestObserver *observer = [[TestObserver alloc] init];