// // CmdKeyInterceptApplication.m // LeanCalc // // Created by Marc Liyanage on 13.02.05. // Copyright 2005 __MyCompanyName__. All rights reserved. // #import "CmdKeyInterceptApplication.h" @implementation CmdKeyInterceptApplication - (void)sendEvent:(NSEvent *)event { if ([event type] != NSKeyDown) { [super sendEvent:event]; return; } /* Look at the top 16 bits, only intercept * key down events whose only modifier is the command key */ if (([event modifierFlags] & 0xffff0000) != NSCommandKeyMask) { [super sendEvent:event]; return; } int index = [[event characters] intValue]; if (index > 9 || index < 1) { [super sendEvent:event]; return; } [self sendAction:@selector(insertPrevious:) to:nil from:[NSNumber numberWithInt:index]]; } @end