From 22e1b525a5918b10014dd340b8eaab18552658d7 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 18 May 2014 13:41:40 +0200 Subject: [PATCH] Cleaned up shared key repeat detection. --- src/input.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/input.c b/src/input.c index 4b52a220..6479195b 100644 --- a/src/input.c +++ b/src/input.c @@ -130,24 +130,19 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled) void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods) { - GLboolean repeated = GL_FALSE; - - if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) - return; - if (key >= 0 && key <= GLFW_KEY_LAST) { - if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) - repeated = GL_TRUE; + if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) + return; if (action == GLFW_RELEASE && window->stickyKeys) window->key[key] = _GLFW_STICK; else window->key[key] = (char) action; - } - if (repeated) - action = GLFW_REPEAT; + if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) + action = GLFW_REPEAT; + } if (window->callbacks.key) window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);