From 2c920fbb8bb13382274be590f351d0b93960e7df Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 10 Oct 2013 19:41:56 +0200 Subject: [PATCH] Clarified character callback parameter. --- include/GLFW/glfw3.h | 2 +- src/input.c | 6 +++--- src/internal.h | 4 ++-- tests/events.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 55b240cf..733a39ba 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -765,7 +765,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); * This is the function signature for Unicode character callback functions. * * @param[in] window The window that received the event. - * @param[in] character The Unicode code point of the character. + * @param[in] codepoint The Unicode code point of the character. * * @sa glfwSetCharCallback * diff --git a/src/input.c b/src/input.c index 45fb396f..866a4891 100644 --- a/src/input.c +++ b/src/input.c @@ -148,13 +148,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods); } -void _glfwInputChar(_GLFWwindow* window, unsigned int character) +void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint) { - if (character < 32 || (character > 126 && character < 160)) + if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) return; if (window->callbacks.character) - window->callbacks.character((GLFWwindow*) window, character); + window->callbacks.character((GLFWwindow*) window, codepoint); } void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) diff --git a/src/internal.h b/src/internal.h index 381f3a04..357277eb 100644 --- a/src/internal.h +++ b/src/internal.h @@ -624,10 +624,10 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m /*! @brief Notifies shared code of a Unicode character input event. * @param[in] window The window that received the event. - * @param[in] character The Unicode code point of the input character. + * @param[in] codepoint The Unicode code point of the input character. * @ingroup event */ -void _glfwInputChar(_GLFWwindow* window, unsigned int character); +void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint); /*! @brief Notifies shared code of a scroll event. * @param[in] window The window that received the event. diff --git a/tests/events.c b/tests/events.c index 009ea020..7ac69c8e 100644 --- a/tests/events.c +++ b/tests/events.c @@ -228,12 +228,12 @@ static const char* get_mods_name(int mods) return name; } -static const char* get_character_string(int character) +static const char* get_character_string(int codepoint) { // This assumes UTF-8, which is stupid static char result[6 + 1]; - int length = wctomb(result, character); + int length = wctomb(result, codepoint); if (length == -1) length = 0; @@ -372,13 +372,13 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, } } -static void char_callback(GLFWwindow* window, unsigned int character) +static void char_callback(GLFWwindow* window, unsigned int codepoint) { printf("%08x at %0.3f: Character 0x%08x (%s) input\n", counter++, glfwGetTime(), - character, - get_character_string(character)); + codepoint, + get_character_string(codepoint)); } void monitor_callback(GLFWmonitor* monitor, int event)