From 648c8e73716296e2e36eed4c59343bf6ec0e2c7f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 16 Apr 2013 16:06:28 +0200 Subject: [PATCH] Put synthetic key releases after defocus event. This allows the application to separate actual from synthetic key release events. --- src/window.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/window.c b/src/window.c index f95d7d24..5b5daf5a 100644 --- a/src/window.c +++ b/src/window.c @@ -68,6 +68,11 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused) { 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++) { @@ -81,11 +86,6 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused) if (window->mouseButton[i] == GLFW_PRESS) _glfwInputMouseClick(window, i, GLFW_RELEASE); } - - _glfw.focusedWindow = NULL; - - if (window->callbacks.focus) - window->callbacks.focus((GLFWwindow*) window, focused); } } }