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
@@ -460,7 +462,13 @@ int mpl_check_modifier(
460
462
case 1 : [[NSCursor arrowCursor ] set ]; break ;
461
463
case 2 : [[NSCursor pointingHandCursor ] set ]; break ;
462
464
case 3 : [[NSCursor crosshairCursor ] set ]; break ;
463
- case 4 : [[NSCursor openHandCursor ] set ]; break ;
465
+ case 4 :
466
+ if (leftMouseGrabbing) {
467
+ [[NSCursor closedHandCursor ] set ];
468
+ } else {
469
+ [[NSCursor openHandCursor ] set ];
470
+ }
471
+ break ;
464
472
/* OSX handles busy state itself so no need to set a cursor here */
465
473
case 5 : break ;
466
474
case 6 : [[NSCursor resizeLeftRightCursor ] set ]; break ;
@@ -1521,8 +1529,10 @@ - (void)mouseDown:(NSEvent *)event
1521
1529
else
1522
1530
{
1523
1531
button = 1 ;
1524
- if ([NSCursor currentCursor ]==[NSCursor openHandCursor ])
1532
+ if ([NSCursor currentCursor ]==[NSCursor openHandCursor ]) {
1533
+ leftMouseGrabbing = true ;
1525
1534
[[NSCursor closedHandCursor ] set ];
1535
+ }
1526
1536
}
1527
1537
break ;
1528
1538
}
@@ -1549,6 +1559,7 @@ - (void)mouseUp:(NSEvent *)event
1549
1559
y = location.y * device_scale;
1550
1560
switch ([event type ])
1551
1561
{ case NSEventTypeLeftMouseUp:
1562
+ leftMouseGrabbing = false ;
1552
1563
button = 1 ;
1553
1564
if ([NSCursor currentCursor ]==[NSCursor closedHandCursor ])
1554
1565
[[NSCursor openHandCursor ] set ];
0 commit comments