From 54a1fad13b128df0d3b19ff4a4d93d366eab8992 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 30 Dec 2014 21:55:20 +0100 Subject: [PATCH] Fixed cursor sometimes not being set. --- src/cocoa_platform.h | 1 - src/cocoa_window.m | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 368fb10f..6aafa325 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -62,7 +62,6 @@ typedef struct _GLFWwindowNS id delegate; id view; unsigned int modifierFlags; - int cursorInside; } _GLFWwindowNS; diff --git a/src/cocoa_window.m b/src/cocoa_window.m index b752da49..4b91635d 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -439,13 +439,11 @@ static int translateKey(unsigned int key) - (void)mouseExited:(NSEvent *)event { - window->ns.cursorInside = GL_FALSE; _glfwInputCursorEnter(window, GL_FALSE); } - (void)mouseEntered:(NSEvent *)event { - window->ns.cursorInside = GL_TRUE; _glfwInputCursorEnter(window, GL_TRUE); } @@ -1199,7 +1197,10 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { - if (window->cursorMode == GLFW_CURSOR_NORMAL && window->ns.cursorInside) + const NSPoint p = [window->ns.object mouseLocationOutsideOfEventStream]; + + if (window->cursorMode == GLFW_CURSOR_NORMAL && + [window->ns.view mouse:p inRect:[window->ns.view frame]]) { if (cursor) [(NSCursor*) cursor->ns.object set];