From dc5c264e26117215454070a6fcbdfcc08bbeab4d Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 19 May 2014 15:00:50 +0200 Subject: [PATCH] Fixed broken key repeat detection. --- src/input.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/input.c b/src/input.c index 6479195b..84da9f1d 100644 --- a/src/input.c +++ b/src/input.c @@ -132,15 +132,20 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m { if (key >= 0 && key <= GLFW_KEY_LAST) { + GLboolean repeated = GL_FALSE; + if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) return; + if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) + repeated = GL_TRUE; + if (action == GLFW_RELEASE && window->stickyKeys) window->key[key] = _GLFW_STICK; else window->key[key] = (char) action; - if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) + if (repeated) action = GLFW_REPEAT; }