Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf588d2b

Browse files
authored
Merge pull request#25548 from greglucas/macosx-cursor-hand
FIX: macosx keep track of mouse up/down for cursor hand changes
2 parentsdebfcef +03730da commitf588d2b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

‎src/_macosx.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
staticbool keyChangeShift =false;
4646
staticbool keyChangeOption =false;
4747
staticbool keyChangeCapsLock =false;
48+
/* Keep track of the current mouse up/down state for open/closed cursor hand*/
49+
staticbool leftMouseGrabbing =false;
4850

4951
/* -------------------------- Helper function ----------------------------*/
5052

@@ -457,7 +459,13 @@ int mpl_check_modifier(
457459
case1: [[NSCursorarrowCursor]set];break;
458460
case2: [[NSCursorpointingHandCursor]set];break;
459461
case3: [[NSCursorcrosshairCursor]set];break;
460-
case4: [[NSCursoropenHandCursor]set];break;
462+
case4:
463+
if (leftMouseGrabbing) {
464+
[[NSCursorclosedHandCursor]set];
465+
}else {
466+
[[NSCursoropenHandCursor]set];
467+
}
468+
break;
461469
/* OSX handles busy state itself so no need to set a cursor here*/
462470
case5:break;
463471
case6: [[NSCursorresizeLeftRightCursor]set];break;
@@ -1503,8 +1511,10 @@ - (void)mouseDown:(NSEvent *)event
15031511
else
15041512
{
15051513
button =1;
1506-
if ([NSCursorcurrentCursor]==[NSCursoropenHandCursor])
1514+
if ([NSCursorcurrentCursor]==[NSCursoropenHandCursor]) {
1515+
leftMouseGrabbing =true;
15071516
[[NSCursorclosedHandCursor]set];
1517+
}
15081518
}
15091519
break;
15101520
}
@@ -1531,6 +1541,7 @@ - (void)mouseUp:(NSEvent *)event
15311541
y = location.y * device_scale;
15321542
switch ([eventtype])
15331543
{case NSEventTypeLeftMouseUp:
1544+
leftMouseGrabbing =false;
15341545
button =1;
15351546
if ([NSCursorcurrentCursor]==[NSCursorclosedHandCursor])
15361547
[[NSCursoropenHandCursor]set];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp