Use NSWindow noResponseFor: to avoid beeps on Skia/OSX fork

This commit is contained in:
David Capello 2016-04-11 14:41:01 -03:00
parent df9c555c87
commit 8e06d61f74
2 changed files with 11 additions and 5 deletions

View File

@ -131,9 +131,7 @@ bool is_key_pressed(KeyScancode scancode)
- (void)keyDown:(NSEvent*)event
{
#if 0 // Avoid beeps TODO comment this when the OS X menus are ready
[super keyDown:event];
#endif
KeyScancode scancode = cocoavk_to_scancode(event.keyCode);
if (scancode >= 0 && scancode < kKeyScancodes)
@ -155,9 +153,7 @@ bool is_key_pressed(KeyScancode scancode)
- (void)keyUp:(NSEvent*)event
{
#if 0
[super keyUp:event];
#endif
KeyScancode scancode = cocoavk_to_scancode(event.keyCode);
if (scancode >= 0 && scancode < kKeyScancodes)

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2012-2015 David Capello
// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -158,4 +158,14 @@ using namespace she;
return (nsCursor != nil ? YES: NO);
}
- (void)noResponderFor:(SEL)eventSelector
{
if (eventSelector == @selector(keyDown:)) {
// Do nothing (avoid beep)
}
else {
[super noResponderFor:eventSelector];
}
}
@end