mirror of
https://github.com/glfw/glfw.git
synced 2024-11-13 14:03:52 +00:00
Fixed broken key repeat detection.
This commit is contained in:
parent
22e1b525a5
commit
dc5c264e26
@ -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…
Reference in New Issue
Block a user