From 6a7dbfee294d88a9f7d0a6a701fdafc0dca43b74 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 7 Mar 2013 17:37:07 +0100 Subject: [PATCH] Simplified Cocoa key input. --- src/cocoa_window.m | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 0d709cd7..9edbb9e5 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -436,20 +436,14 @@ static int convertMacKeyCode(unsigned int macKeyCode) - (void)keyDown:(NSEvent *)event { - NSUInteger i, length; - NSString* characters; - const int key = convertMacKeyCode([event keyCode]); - if (key == -1) - return; - - _glfwInputKey(window, key, GLFW_PRESS); + _glfwInputKey(window, convertMacKeyCode([event keyCode]), GLFW_PRESS); if ([event modifierFlags] & NSCommandKeyMask) [super keyDown:event]; else { - characters = [event characters]; - length = [characters length]; + NSString* characters = [event characters]; + NSUInteger i, length = [characters length]; for (i = 0; i < length; i++) _glfwInputChar(window, [characters characterAtIndex:i]); @@ -476,9 +470,7 @@ static int convertMacKeyCode(unsigned int macKeyCode) - (void)keyUp:(NSEvent *)event { - int key = convertMacKeyCode([event keyCode]); - if (key != -1) - _glfwInputKey(window, key, GLFW_RELEASE); + _glfwInputKey(window, convertMacKeyCode([event keyCode]), GLFW_RELEASE); } - (void)scrollWheel:(NSEvent *)event