From a3ca7ad93a51bfeb1155766523707a8df8e17421 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 6 Aug 2013 20:46:26 +0200 Subject: [PATCH] Removed cursor centering XFlush hack. --- src/x11_window.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index c8eeeb74..9b3791c2 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1106,24 +1106,12 @@ void _glfwPlatformPollEvents(void) processEvent(&event); } - // Check whether the cursor has moved inside an focused window that has - // captured the cursor (because then it needs to be re-centered) - - _GLFWwindow* window; - window = _glfw.focusedWindow; - if (window) + _GLFWwindow* window = _glfw.focusedWindow; + if (window && window->cursorMode == GLFW_CURSOR_DISABLED) { - if (window->cursorMode == GLFW_CURSOR_DISABLED) - { - int width, height; - _glfwPlatformGetWindowSize(window, &width, &height); - _glfwPlatformSetCursorPos(window, width / 2, height / 2); - - // NOTE: This is a temporary fix. It works as long as you use - // offsets accumulated over the course of a frame, instead of - // performing the necessary actions per callback call. - XFlush(_glfw.x11.display); - } + int width, height; + _glfwPlatformGetWindowSize(window, &width, &height); + _glfwPlatformSetCursorPos(window, width / 2, height / 2); } }