From fafe1732b584f34d4306695afdb235c2744ae0bb Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 6 Sep 2016 16:21:15 +0200 Subject: [PATCH] Cleanup --- src/x11_init.c | 8 ++++---- src/x11_platform.h | 2 +- src/x11_window.c | 9 +++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/x11_init.c b/src/x11_init.c index 87bd877e..00e30e8b 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -745,7 +745,7 @@ int _glfwPlatformInit(void) if (!initExtensions()) return GLFW_FALSE; - _glfw.x11.cursor = createHiddenCursor(); + _glfw.x11.hiddenCursorHandle = createHiddenCursor(); if (XSupportsLocale()) { @@ -781,10 +781,10 @@ void _glfwPlatformTerminate(void) _glfw.x11.x11xcb.handle = NULL; } - if (_glfw.x11.cursor) + if (_glfw.x11.hiddenCursorHandle) { - XFreeCursor(_glfw.x11.display, _glfw.x11.cursor); - _glfw.x11.cursor = (Cursor) 0; + XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle); + _glfw.x11.hiddenCursorHandle = (Cursor) 0; } free(_glfw.x11.clipboardString); diff --git a/src/x11_platform.h b/src/x11_platform.h index 074ab70d..65f34a48 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -137,7 +137,7 @@ typedef struct _GLFWlibraryX11 Window root; // Invisible cursor for hidden cursor mode - Cursor cursor; + Cursor hiddenCursorHandle; // Context for mapping window XIDs to _GLFWwindow pointers XContext context; // XIM input method diff --git a/src/x11_window.c b/src/x11_window.c index e98d9834..d8b41e29 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -458,7 +458,10 @@ static void updateCursorImage(_GLFWwindow* window) XUndefineCursor(_glfw.x11.display, window->x11.handle); } else - XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor); + { + XDefineCursor(_glfw.x11.display, window->x11.handle, + _glfw.x11.hiddenCursorHandle); + } } // Create the X11 window (and its colormap) @@ -2140,7 +2143,9 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) XGrabPointer(_glfw.x11.display, window->x11.handle, True, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, GrabModeAsync, GrabModeAsync, - window->x11.handle, _glfw.x11.cursor, CurrentTime); + window->x11.handle, + _glfw.x11.hiddenCursorHandle, + CurrentTime); } else if (_glfw.x11.disabledCursorWindow == window) {