Fixed broken key repeat detection.

This commit is contained in:
Camilla Berglund 2014-05-19 15:00:50 +02:00
parent 22e1b525a5
commit dc5c264e26

View File

@ -132,15 +132,20 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
{ {
if (key >= 0 && key <= GLFW_KEY_LAST) if (key >= 0 && key <= GLFW_KEY_LAST)
{ {
GLboolean repeated = GL_FALSE;
if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE)
return; return;
if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS)
repeated = GL_TRUE;
if (action == GLFW_RELEASE && window->stickyKeys) if (action == GLFW_RELEASE && window->stickyKeys)
window->key[key] = _GLFW_STICK; window->key[key] = _GLFW_STICK;
else else
window->key[key] = (char) action; window->key[key] = (char) action;
if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) if (repeated)
action = GLFW_REPEAT; action = GLFW_REPEAT;
} }