Turn off the annoying beep when a key down is passed all the way up the handler chain.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2009-02-24 05:51:52 +00:00
parent 5a0dca116d
commit 9130dfd784

View File

@@ -61,6 +61,8 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
// wx native implementation classes
//
typedef void (*wxOSX_NoResponderHandlerPtr)(NSView* self, SEL _cmd, SEL selector);
@interface wxNSWindow : NSWindow
{
@@ -69,7 +71,7 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
- (void)setImplementation: (wxNonOwnedWindowCocoaImpl *) theImplementation;
- (wxNonOwnedWindowCocoaImpl*) implementation;
- (void)noResponderFor: (SEL) selector;
@end
@implementation wxNSWindow
@@ -84,6 +86,15 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
return impl;
}
// NB: if we don't do this, all key downs that get handled lead to a NSBeep
- (void)noResponderFor: (SEL) selector
{
if (selector != @selector(keyDown:))
{
wxOSX_NoResponderHandlerPtr superimpl = (wxOSX_NoResponderHandlerPtr) [[self superclass] instanceMethodForSelector:@selector(noResponderFor:)];
superimpl(self, @selector(noResponderFor:), selector);
}
}
@end
@@ -95,7 +106,7 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
- (void)setImplementation: (wxNonOwnedWindowCocoaImpl *) theImplementation;
- (wxNonOwnedWindowCocoaImpl*) implementation;
- (void)noResponderFor: (SEL) selector;
@end
@implementation wxNSPanel
@@ -110,6 +121,16 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
return impl;
}
// NB: if we don't do this, all key downs that get handled lead to a NSBeep
- (void)noResponderFor: (SEL) selector
{
if (selector != @selector(keyDown:))
{
wxOSX_NoResponderHandlerPtr superimpl = (wxOSX_NoResponderHandlerPtr) [[self superclass] instanceMethodForSelector:@selector(noResponderFor:)];
superimpl(self, @selector(noResponderFor:), selector);
}
}
@end