From f5a996a5af98d1d7cc0bb00f59c120be906c8c2c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 2 Apr 2014 13:29:07 +0200 Subject: [PATCH] Fixed focus events triggered by window frame. --- README.md | 1 + src/x11_window.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0ce4db50..05d338e2 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ The following dependencies are needed by the examples and test programs: `GLX_SGIX_fbconfig` was unavailable - [X11] Bugfix: The message type of ICCCM protocol events was not checked - [X11] Bugfix: `glfwDestroyWindow` did not flush the output buffer. + - [X11] Bugfix: Window frame interactions were reported as focus events ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index a585dadf..2292ab34 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -913,20 +913,26 @@ static void processEvent(XEvent *event) case FocusIn: { - _glfwInputWindowFocus(window, GL_TRUE); + if (event->xfocus.mode == NotifyNormal) + { + _glfwInputWindowFocus(window, GL_TRUE); - if (window->cursorMode == GLFW_CURSOR_DISABLED) - disableCursor(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + disableCursor(window); + } break; } case FocusOut: { - _glfwInputWindowFocus(window, GL_FALSE); + if (event->xfocus.mode == NotifyNormal) + { + _glfwInputWindowFocus(window, GL_FALSE); - if (window->cursorMode == GLFW_CURSOR_DISABLED) - restoreCursor(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + restoreCursor(window); + } break; }