diff --git a/src/internal.h b/src/internal.h index 12a9d3bf..11f586bc 100644 --- a/src/internal.h +++ b/src/internal.h @@ -294,7 +294,6 @@ void _glfwSetError(int error); void _glfwClearWindowHints(void); // Input handling (window.c) -void _glfwClearInput(_GLFWwindow* window); void _glfwInputDeactivation(_GLFWwindow* window); void _glfwInputKey(_GLFWwindow* window, int key, int action); void _glfwInputChar(_GLFWwindow* window, int character); diff --git a/src/window.c b/src/window.c index 412e4b87..b87d5853 100644 --- a/src/window.c +++ b/src/window.c @@ -70,6 +70,38 @@ static void closeFlaggedWindows(void) } +//======================================================================== +// Clear all input state +//======================================================================== + +void clearInputState(_GLFWwindow* window) +{ + int i; + + // Release all keyboard keys + for (i = 0; i <= GLFW_KEY_LAST; i++) + window->key[i] = GLFW_RELEASE; + + // Release all mouse buttons + for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) + window->mouseButton[i] = GLFW_RELEASE; + + // Set mouse position to (0,0) + window->mousePosX = 0; + window->mousePosY = 0; + + // Set mouse wheel position to 0 + window->wheelPos = 0; + + // The default is to use non sticky keys and mouse buttons + window->stickyKeys = GL_FALSE; + window->stickyMouseButtons = GL_FALSE; + + // The default is to disable key repeat + window->keyRepeat = GL_FALSE; +} + + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// @@ -109,38 +141,6 @@ void _glfwInputDeactivation(_GLFWwindow* window) } -//======================================================================== -// Clear all input state -//======================================================================== - -void _glfwClearInput(_GLFWwindow* window) -{ - int i; - - // Release all keyboard keys - for (i = 0; i <= GLFW_KEY_LAST; i++) - window->key[i] = GLFW_RELEASE; - - // Release all mouse buttons - for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) - window->mouseButton[i] = GLFW_RELEASE; - - // Set mouse position to (0,0) - window->mousePosX = 0; - window->mousePosY = 0; - - // Set mouse wheel position to 0 - window->wheelPos = 0; - - // The default is to use non sticky keys and mouse buttons - window->stickyKeys = GL_FALSE; - window->stickyMouseButtons = GL_FALSE; - - // The default is to disable key repeat - window->keyRepeat = GL_FALSE; -} - - //======================================================================== // Register keyboard activity //======================================================================== @@ -495,8 +495,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, return GL_FALSE; } - // Clear GLFW window state - _glfwClearInput(window); + clearInputState(window); // Check width & height if (width > 0 && height <= 0)