Clearing of input state only occurs locally.

This commit is contained in:
Camilla Berglund 2010-09-16 17:45:36 +02:00
parent 8d8eb0c4d5
commit 40193213e5
2 changed files with 33 additions and 35 deletions

View File

@ -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);

View File

@ -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)