From 64048dede39b069bd1375e2820b07530be9587b2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Sep 2012 02:50:42 -0700 Subject: [PATCH] Fixed beeping introduced when we started passing key events through the responder chain. --- src/video/cocoa/SDL_cocoawindow.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index d50cd14d7..274c456da 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -224,6 +224,29 @@ - (void)windowDidResignKey:(NSNotification *)aNotification } } +// We'll respond to key events by doing nothing so we don't beep. +// We could handle key messages here, but we lose some in the NSApp dispatch, +// where they get converted to action messages, etc. +- (void)flagsChanged:(NSEvent *)theEvent +{ + //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent); +} +- (void)keyDown:(NSEvent *)theEvent +{ + //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent); +} +- (void)keyUp:(NSEvent *)theEvent +{ + //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent); +} + +// We'll respond to selectors by doing nothing so we don't beep. +// The escape key gets converted to a "cancel" selector, etc. +- (void)doCommandBySelector:(SEL)aSelector +{ + //NSLog(@"doCommandBySelector: %@\n", NSStringFromSelector(aSelector)); +} + - (void)mouseDown:(NSEvent *)theEvent { int button;