Attempt to fix input delays on GLFW

This commit is contained in:
erorcun 2021-01-27 18:26:48 +03:00
parent 843dd9b5e1
commit 8846f50cb7

View File

@ -1416,7 +1416,7 @@ bool rshiftStatus = false;
void void
keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods) keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods)
{ {
if (key >= 0 && key <= GLFW_KEY_LAST) { if (key >= 0 && key <= GLFW_KEY_LAST && action != GLFW_REPEAT) {
RsKeyCodes ks = (RsKeyCodes)keymap[key]; RsKeyCodes ks = (RsKeyCodes)keymap[key];
if (key == GLFW_KEY_LEFT_SHIFT) if (key == GLFW_KEY_LEFT_SHIFT)
@ -1427,7 +1427,6 @@ keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods)
if (action == GLFW_RELEASE) RsKeyboardEventHandler(rsKEYUP, &ks); if (action == GLFW_RELEASE) RsKeyboardEventHandler(rsKEYUP, &ks);
else if (action == GLFW_PRESS) RsKeyboardEventHandler(rsKEYDOWN, &ks); else if (action == GLFW_PRESS) RsKeyboardEventHandler(rsKEYDOWN, &ks);
else if (action == GLFW_REPEAT) RsKeyboardEventHandler(rsKEYDOWN, &ks);
} }
} }