[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25075] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Cocoa: suppress unwanted beep when pressing Cmd + key on 10.4

Damien Plisson damien.plisson at yahoo.fr
Wed Dec 2 16:02:29 CET 2009


Revision: 25075
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25075
Author:   damien78
Date:     2009-12-02 16:02:29 +0100 (Wed, 02 Dec 2009)

Log Message:
-----------
Cocoa: suppress unwanted beep when pressing Cmd + key on 10.4

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-12-02 14:39:49 UTC (rev 25074)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-12-02 15:02:29 UTC (rev 25075)
@@ -230,6 +230,28 @@
 - (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;





More information about the Bf-blender-cvs mailing list