45
45
static bool keyChangeShift =false ;
46
46
static bool keyChangeOption =false ;
47
47
static bool keyChangeCapsLock =false ;
48
+ /* Keep track of the current mouse up/down state for open/closed cursor hand*/
49
+ static bool leftMouseGrabbing =false ;
48
50
49
51
/* -------------------------- Helper function ----------------------------*/
50
52
@@ -457,7 +459,13 @@ int mpl_check_modifier(
457
459
case 1 : [[NSCursor arrowCursor ]set ];break ;
458
460
case 2 : [[NSCursor pointingHandCursor ]set ];break ;
459
461
case 3 : [[NSCursor crosshairCursor ]set ];break ;
460
- case 4 : [[NSCursor openHandCursor ]set ];break ;
462
+ case 4 :
463
+ if (leftMouseGrabbing) {
464
+ [[NSCursor closedHandCursor ]set ];
465
+ }else {
466
+ [[NSCursor openHandCursor ]set ];
467
+ }
468
+ break ;
461
469
/* OSX handles busy state itself so no need to set a cursor here*/
462
470
case 5 :break ;
463
471
case 6 : [[NSCursor resizeLeftRightCursor ]set ];break ;
@@ -1503,8 +1511,10 @@ - (void)mouseDown:(NSEvent *)event
1503
1511
else
1504
1512
{
1505
1513
button =1 ;
1506
- if ([NSCursor currentCursor ]==[NSCursor openHandCursor ])
1514
+ if ([NSCursor currentCursor ]==[NSCursor openHandCursor ]) {
1515
+ leftMouseGrabbing =true ;
1507
1516
[[NSCursor closedHandCursor ]set ];
1517
+ }
1508
1518
}
1509
1519
break ;
1510
1520
}
@@ -1531,6 +1541,7 @@ - (void)mouseUp:(NSEvent *)event
1531
1541
y = location.y * device_scale;
1532
1542
switch ([eventtype ])
1533
1543
{case NSEventTypeLeftMouseUp:
1544
+ leftMouseGrabbing =false ;
1534
1545
button =1 ;
1535
1546
if ([NSCursor currentCursor ]==[NSCursor closedHandCursor ])
1536
1547
[[NSCursor openHandCursor ]set ];