Fixed broken key repeat detection.

master
Camilla Berglund ago%!(EXTRA string=11 years)
parent 22e1b525a5
commit dc5c264e26
  1. 7
      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) 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;
} }

Loading…
Cancel
Save