diff --git a/include/GL/glfw.h b/include/GL/glfw.h index 5f433bc7..63e85609 100644 --- a/include/GL/glfw.h +++ b/include/GL/glfw.h @@ -371,7 +371,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int); typedef void (* GLFWmouseposfun)(GLFWwindow,int,int); typedef void (* GLFWmousewheelfun)(GLFWwindow,int); typedef void (* GLFWkeyfun)(GLFWwindow,int,int); -typedef void (* GLFWcharfun)(GLFWwindow,int,int); +typedef void (* GLFWcharfun)(GLFWwindow,int); /************************************************************************* diff --git a/lib/internal.h b/lib/internal.h index cb217b98..297a5995 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -276,7 +276,7 @@ void _glfwClearWindowHints(void); void _glfwClearInput(_GLFWwindow* window); void _glfwInputDeactivation(_GLFWwindow* window); void _glfwInputKey(_GLFWwindow* window, int key, int action); -void _glfwInputChar(_GLFWwindow* window, int character, int action); +void _glfwInputChar(_GLFWwindow* window, int character); void _glfwInputMouseClick(_GLFWwindow* window, int button, int action); // OpenGL extensions (glext.c) diff --git a/lib/window.c b/lib/window.c index 67f93f1e..ab683074 100644 --- a/lib/window.c +++ b/lib/window.c @@ -149,7 +149,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int action) // Register (keyboard) character activity //======================================================================== -void _glfwInputChar(_GLFWwindow* window, int character, int action) +void _glfwInputChar(_GLFWwindow* window, int character) { int keyrepeat = 0; @@ -157,36 +157,8 @@ void _glfwInputChar(_GLFWwindow* window, int character, int action) if (!((character >= 32 && character <= 126) || character >= 160)) return; - // Is this a key repeat? - if (action == GLFW_PRESS && window->lastChar == character) - keyrepeat = 1; - - // Store this character as last character (or clear it, if released) - if (action == GLFW_PRESS) - window->lastChar = character; - else - window->lastChar = 0; - - if (action != GLFW_PRESS) - { - // This intentionally breaks release notifications for Unicode - // characters, partly to see if anyone cares but mostly because it's - // a nonsensical concept to begin with - // - // It will remain broken either until its removal in the 3.0 API or - // until someone explains, in a way that makes sense to people outside - // the US and Scandinavia, what "Unicode character up" actually means - // - // If what you want is "physical key up" then you should be using the - // key functions and/or the key callback, NOT the Unicode input - // - // However, if your particular application uses this misfeature for... - // something, you can re-enable it by removing this if-statement - return; - } - if (window->charCallback && (window->keyRepeat || !keyrepeat)) - window->charCallback(window, character, action); + window->charCallback(window, character); } diff --git a/lib/x11/x11_window.c b/lib/x11/x11_window.c index 722939a9..dbeaca88 100644 --- a/lib/x11/x11_window.c +++ b/lib/x11/x11_window.c @@ -1027,7 +1027,7 @@ static GLboolean processSingleEvent(void) _glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_PRESS); // Translate and report character input - _glfwInputChar(window, translateChar(&event.xkey), GLFW_PRESS); + _glfwInputChar(window, translateChar(&event.xkey)); break; } @@ -1065,9 +1065,6 @@ static GLboolean processSingleEvent(void) // Translate and report key release _glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_RELEASE); - // Translate and report character input - _glfwInputChar(window, translateChar(&event.xkey), GLFW_RELEASE); - break; } diff --git a/tests/events.c b/tests/events.c index 5004bf41..1472d980 100644 --- a/tests/events.c +++ b/tests/events.c @@ -250,11 +250,13 @@ static void key_callback(GLFWwindow window, int key, int action) } } -static void char_callback(GLFWwindow window, int character, int action) +static void char_callback(GLFWwindow window, int character) { - printf("%08x at %0.3f: Character 0x%04x", counter++, glfwGetTime(), character); - - printf(" (%s) %s\n", get_character_string(character), get_action_name(action)); + printf("%08x at %0.3f: Character 0x%04x (%s)\n", + counter++, + glfwGetTime(), + character, + get_character_string(character)); } int main(void)