diff --git a/src/_macosx.m b/src/_macosx.m index 7042f6da35cc..38c99cd9760e 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -45,6 +45,8 @@ static bool keyChangeShift = false; static bool keyChangeOption = false; static bool keyChangeCapsLock = false; +/* Keep track of the current mouse up/down state for open/closed cursor hand */ +static bool leftMouseGrabbing = false; /* -------------------------- Helper function ---------------------------- */ @@ -457,7 +459,13 @@ int mpl_check_modifier( case 1: [[NSCursor arrowCursor] set]; break; case 2: [[NSCursor pointingHandCursor] set]; break; case 3: [[NSCursor crosshairCursor] set]; break; - case 4: [[NSCursor openHandCursor] set]; break; + case 4: + if (leftMouseGrabbing) { + [[NSCursor closedHandCursor] set]; + } else { + [[NSCursor openHandCursor] set]; + } + break; /* OSX handles busy state itself so no need to set a cursor here */ case 5: break; case 6: [[NSCursor resizeLeftRightCursor] set]; break; @@ -1503,8 +1511,10 @@ - (void)mouseDown:(NSEvent *)event else { button = 1; - if ([NSCursor currentCursor]==[NSCursor openHandCursor]) + if ([NSCursor currentCursor]==[NSCursor openHandCursor]) { + leftMouseGrabbing = true; [[NSCursor closedHandCursor] set]; + } } break; } @@ -1531,6 +1541,7 @@ - (void)mouseUp:(NSEvent *)event y = location.y * device_scale; switch ([event type]) { case NSEventTypeLeftMouseUp: + leftMouseGrabbing = false; button = 1; if ([NSCursor currentCursor]==[NSCursor closedHandCursor]) [[NSCursor openHandCursor] set];