From 863668a145477299be704de33ce282ad94bcba37 Mon Sep 17 00:00:00 2001 From: Damien Plisson Date: Wed, 2 Dec 2009 15:02:29 +0000 Subject: [PATCH] Cocoa: suppress unwanted beep when pressing Cmd + key on 10.4 --- intern/ghost/intern/GHOST_WindowCocoa.mm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index b1b23963b3d..4058d721bdb 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -230,6 +230,28 @@ extern "C" { - (void)keyDown:(NSEvent *)theEvent {} +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 +//Cmd+key are handled differently before 10.5 +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + NSString *chars = [theEvent charactersIgnoringModifiers]; + + if ([chars length] <1) + return NO; + + //Let cocoa handle menu shortcuts + switch ([chars characterAtIndex:0]) { + case 'q': + case 'w': + case 'h': + case 'm': + return NO; + default: + return YES; + } +} +#endif + - (BOOL)isOpaque { return YES;