mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Clearing of input state only occurs locally.
This commit is contained in:
parent
8d8eb0c4d5
commit
40193213e5
@ -294,7 +294,6 @@ void _glfwSetError(int error);
|
|||||||
void _glfwClearWindowHints(void);
|
void _glfwClearWindowHints(void);
|
||||||
|
|
||||||
// Input handling (window.c)
|
// Input handling (window.c)
|
||||||
void _glfwClearInput(_GLFWwindow* window);
|
|
||||||
void _glfwInputDeactivation(_GLFWwindow* window);
|
void _glfwInputDeactivation(_GLFWwindow* window);
|
||||||
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
||||||
void _glfwInputChar(_GLFWwindow* window, int character);
|
void _glfwInputChar(_GLFWwindow* window, int character);
|
||||||
|
67
src/window.c
67
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 //////
|
////// 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
|
// Register keyboard activity
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -495,8 +495,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear GLFW window state
|
clearInputState(window);
|
||||||
_glfwClearInput(window);
|
|
||||||
|
|
||||||
// Check width & height
|
// Check width & height
|
||||||
if (width > 0 && height <= 0)
|
if (width > 0 && height <= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user