From f236fc2f613484c6daf01c61297133a80a6df22e Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 2 Oct 2012 18:03:21 +0200 Subject: [PATCH] Fixed X11 hidden cursor mode. --- src/x11_window.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/x11_window.c b/src/x11_window.c index 9cadaeac..ae920e7f 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -238,6 +238,15 @@ static GLboolean createWindow(_GLFWwindow* window, static void hideCursor(_GLFWwindow* window) { + // Un-grab cursor (in windowed mode only; in fullscreen mode we still + // want the cursor grabbed in order to confine the cursor to the window + // area) + if (window->X11.cursorGrabbed && window->mode == GLFW_WINDOWED) + { + XUngrabPointer(_glfwLibrary.X11.display, CurrentTime); + window->X11.cursorGrabbed = GL_FALSE; + } + if (!window->X11.cursorHidden) { XDefineCursor(_glfwLibrary.X11.display, @@ -280,7 +289,7 @@ static void showCursor(_GLFWwindow* window) // Un-grab cursor (in windowed mode only; in fullscreen mode we still // want the cursor grabbed in order to confine the cursor to the window // area) - if (window->X11.cursorGrabbed) + if (window->X11.cursorGrabbed && window->mode == GLFW_WINDOWED) { XUngrabPointer(_glfwLibrary.X11.display, CurrentTime); window->X11.cursorGrabbed = GL_FALSE;