From 03730da17e64fec3e68659963dec5413d42cfc65 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Sat, 25 Mar 2023 11:51:01 -0600 Subject: [PATCH] FIX: macosx keep track of mouse up/down for cursor hand changes Keep track of whether the left mouse is up or down so that we can set the proper open/closed cursor hand within set_cursor(). --- src/_macosx.m | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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]; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy