mirror of
https://github.com/glfw/glfw.git
synced 2024-11-13 14:03:52 +00:00
Removed use of cursor rectangles.
Poor use of cursor rectangles broke Lion full screen and led to rect reset loop. Cursor image is now updated only with the existing enter/exit detection NSTrackingArea. Fixes #339. Fixes #375.
This commit is contained in:
parent
e57da19d4a
commit
e480c76a11
@ -64,30 +64,19 @@ static void centerCursor(_GLFWwindow *window)
|
|||||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the cursor object that window uses in the specified cursor mode
|
|
||||||
//
|
|
||||||
static NSCursor* getModeCursor(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
|
||||||
{
|
|
||||||
if (window->cursor)
|
|
||||||
return (NSCursor*) window->cursor->ns.object;
|
|
||||||
else
|
|
||||||
return [NSCursor arrowCursor];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return (NSCursor*) _glfw.ns.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the cursor to match the specified cursor mode
|
// Update the cursor to match the specified cursor mode
|
||||||
//
|
//
|
||||||
static void updateModeCursor(_GLFWwindow* window)
|
static void updateModeCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// This is required for the cursor to update if it's inside the window
|
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
||||||
[getModeCursor(window) set];
|
{
|
||||||
|
if (window->cursor)
|
||||||
// This is required for the cursor to update if it's outside the window
|
[(NSCursor*) window->cursor->ns.object set];
|
||||||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
else
|
||||||
|
[[NSCursor arrowCursor] set];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[(NSCursor*) _glfw.ns.cursor set];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter fullscreen mode
|
// Enter fullscreen mode
|
||||||
@ -476,10 +465,11 @@ static int translateKey(unsigned int key)
|
|||||||
[trackingArea release];
|
[trackingArea release];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
const NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
||||||
NSTrackingActiveInKeyWindow |
|
NSTrackingActiveInKeyWindow |
|
||||||
NSTrackingCursorUpdate |
|
NSTrackingCursorUpdate |
|
||||||
NSTrackingInVisibleRect;
|
NSTrackingInVisibleRect |
|
||||||
|
NSTrackingAssumeInside;
|
||||||
|
|
||||||
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||||
options:options
|
options:options
|
||||||
@ -570,11 +560,6 @@ static int translateKey(unsigned int key)
|
|||||||
_glfwInputScroll(window, deltaX, deltaY);
|
_glfwInputScroll(window, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetCursorRects
|
|
||||||
{
|
|
||||||
[self addCursorRect:[self bounds] cursor:getModeCursor(window)];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
|
if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
|
||||||
|
Loading…
Reference in New Issue
Block a user