node-mac-recorder 2.20.6 → 2.20.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cursor_tracker.mm +43 -5
package/package.json
CHANGED
package/src/cursor_tracker.mm
CHANGED
|
@@ -563,13 +563,51 @@ NSString* getCursorType() {
|
|
|
563
563
|
@autoreleasepool {
|
|
564
564
|
g_cursorTypeCounter++;
|
|
565
565
|
|
|
566
|
-
//
|
|
566
|
+
// Hybrid: AX (strict) first, then system cursor fallback.
|
|
567
|
+
BOOL hasCursorPosition = NO;
|
|
568
|
+
CGPoint cursorPos = CGPointZero;
|
|
569
|
+
|
|
570
|
+
CGEventRef event = CGEventCreate(NULL);
|
|
571
|
+
if (event) {
|
|
572
|
+
cursorPos = CGEventGetLocation(event);
|
|
573
|
+
hasCursorPosition = YES;
|
|
574
|
+
CFRelease(event);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (!hasCursorPosition) {
|
|
578
|
+
if ([NSThread isMainThread]) {
|
|
579
|
+
cursorPos = [NSEvent mouseLocation];
|
|
580
|
+
hasCursorPosition = YES;
|
|
581
|
+
} else {
|
|
582
|
+
__block CGPoint fallbackPos = CGPointZero;
|
|
583
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
584
|
+
fallbackPos = [NSEvent mouseLocation];
|
|
585
|
+
});
|
|
586
|
+
cursorPos = fallbackPos;
|
|
587
|
+
hasCursorPosition = YES;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
NSString *axCursorType = nil;
|
|
592
|
+
if (hasCursorPosition) {
|
|
593
|
+
axCursorType = detectCursorTypeUsingAccessibility(cursorPos);
|
|
594
|
+
}
|
|
595
|
+
|
|
567
596
|
NSString *systemCursorType = detectSystemCursorType();
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
597
|
+
|
|
598
|
+
NSString *finalType = nil;
|
|
599
|
+
if (axCursorType && ![axCursorType isEqualToString:@"default"]) {
|
|
600
|
+
finalType = axCursorType;
|
|
601
|
+
} else if (systemCursorType && [systemCursorType length] > 0) {
|
|
602
|
+
finalType = systemCursorType;
|
|
603
|
+
} else if (axCursorType && [axCursorType length] > 0) {
|
|
604
|
+
finalType = axCursorType;
|
|
605
|
+
} else {
|
|
606
|
+
finalType = @"default";
|
|
571
607
|
}
|
|
572
|
-
|
|
608
|
+
|
|
609
|
+
NSLog(@"🎯 FINAL CURSOR TYPE: %@", finalType);
|
|
610
|
+
return finalType;
|
|
573
611
|
}
|
|
574
612
|
}
|
|
575
613
|
|