mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 09:01:46 +00:00
Fixed cursor sometimes not being set.
This commit is contained in:
parent
e480c76a11
commit
54a1fad13b
@ -62,7 +62,6 @@ typedef struct _GLFWwindowNS
|
|||||||
id delegate;
|
id delegate;
|
||||||
id view;
|
id view;
|
||||||
unsigned int modifierFlags;
|
unsigned int modifierFlags;
|
||||||
int cursorInside;
|
|
||||||
|
|
||||||
} _GLFWwindowNS;
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
|
@ -439,13 +439,11 @@ static int translateKey(unsigned int key)
|
|||||||
|
|
||||||
- (void)mouseExited:(NSEvent *)event
|
- (void)mouseExited:(NSEvent *)event
|
||||||
{
|
{
|
||||||
window->ns.cursorInside = GL_FALSE;
|
|
||||||
_glfwInputCursorEnter(window, GL_FALSE);
|
_glfwInputCursorEnter(window, GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseEntered:(NSEvent *)event
|
- (void)mouseEntered:(NSEvent *)event
|
||||||
{
|
{
|
||||||
window->ns.cursorInside = GL_TRUE;
|
|
||||||
_glfwInputCursorEnter(window, GL_TRUE);
|
_glfwInputCursorEnter(window, GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,7 +1197,10 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursor(_GLFWwindow* window, _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)
|
if (cursor)
|
||||||
[(NSCursor*) cursor->ns.object set];
|
[(NSCursor*) cursor->ns.object set];
|
||||||
|
Loading…
Reference in New Issue
Block a user