Removed tautological test.

This commit is contained in:
Camilla Berglund 2014-04-08 15:50:27 +02:00
parent 20792526c6
commit 5e008ad074

View File

@ -48,38 +48,32 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
{ {
if (focused) if (focused)
{ {
if (_glfw.focusedWindow != window) _glfw.focusedWindow = window;
{
_glfw.focusedWindow = window;
if (window->callbacks.focus) if (window->callbacks.focus)
window->callbacks.focus((GLFWwindow*) window, focused); window->callbacks.focus((GLFWwindow*) window, focused);
}
} }
else else
{ {
if (_glfw.focusedWindow == window) int i;
_glfw.focusedWindow = NULL;
if (window->callbacks.focus)
window->callbacks.focus((GLFWwindow*) window, focused);
// Release all pressed keyboard keys
for (i = 0; i <= GLFW_KEY_LAST; i++)
{ {
int i; if (window->key[i] == GLFW_PRESS)
_glfwInputKey(window, i, 0, GLFW_RELEASE, 0);
}
_glfw.focusedWindow = NULL; // Release all pressed mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
if (window->callbacks.focus) {
window->callbacks.focus((GLFWwindow*) window, focused); if (window->mouseButton[i] == GLFW_PRESS)
_glfwInputMouseClick(window, i, GLFW_RELEASE, 0);
// Release all pressed keyboard keys
for (i = 0; i <= GLFW_KEY_LAST; i++)
{
if (window->key[i] == GLFW_PRESS)
_glfwInputKey(window, i, 0, GLFW_RELEASE, 0);
}
// Release all pressed mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{
if (window->mouseButton[i] == GLFW_PRESS)
_glfwInputMouseClick(window, i, GLFW_RELEASE, 0);
}
} }
} }
} }