From 5e008ad0749f104df2d49292cc418dbcd32d0500 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 8 Apr 2014 15:50:27 +0200 Subject: [PATCH] Removed tautological test. --- src/window.c | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/window.c b/src/window.c index 85d7e5ae..a3912501 100644 --- a/src/window.c +++ b/src/window.c @@ -48,38 +48,32 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused) { if (focused) { - if (_glfw.focusedWindow != window) - { - _glfw.focusedWindow = window; + _glfw.focusedWindow = window; - if (window->callbacks.focus) - window->callbacks.focus((GLFWwindow*) window, focused); - } + if (window->callbacks.focus) + window->callbacks.focus((GLFWwindow*) window, focused); } 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; - - if (window->callbacks.focus) - window->callbacks.focus((GLFWwindow*) window, focused); - - // 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); - } + // 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); } } }