node-mac-recorder 2.20.5 → 2.20.6
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 +8 -56
package/package.json
CHANGED
package/src/cursor_tracker.mm
CHANGED
|
@@ -106,7 +106,7 @@ static BOOL CopyAttributeBoolean(AXUIElementRef element, CFStringRef attribute,
|
|
|
106
106
|
return YES;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
static BOOL ElementHasAction(AXUIElementRef element, CFStringRef action) {
|
|
109
|
+
static __attribute__((unused)) BOOL ElementHasAction(AXUIElementRef element, CFStringRef action) {
|
|
110
110
|
if (!element || !action) {
|
|
111
111
|
return NO;
|
|
112
112
|
}
|
|
@@ -563,51 +563,13 @@ NSString* getCursorType() {
|
|
|
563
563
|
@autoreleasepool {
|
|
564
564
|
g_cursorTypeCounter++;
|
|
565
565
|
|
|
566
|
+
// Use only the system cursor type for live detection.
|
|
566
567
|
NSString *systemCursorType = detectSystemCursorType();
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
CGPoint cursorPos = CGPointZero;
|
|
571
|
-
|
|
572
|
-
CGEventRef event = CGEventCreate(NULL);
|
|
573
|
-
if (event) {
|
|
574
|
-
cursorPos = CGEventGetLocation(event);
|
|
575
|
-
hasCursorPosition = YES;
|
|
576
|
-
CFRelease(event);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (!hasCursorPosition) {
|
|
580
|
-
if ([NSThread isMainThread]) {
|
|
581
|
-
cursorPos = [NSEvent mouseLocation];
|
|
582
|
-
hasCursorPosition = YES;
|
|
583
|
-
} else {
|
|
584
|
-
__block CGPoint fallbackPos = CGPointZero;
|
|
585
|
-
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
586
|
-
fallbackPos = [NSEvent mouseLocation];
|
|
587
|
-
});
|
|
588
|
-
cursorPos = fallbackPos;
|
|
589
|
-
hasCursorPosition = YES;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (hasCursorPosition) {
|
|
594
|
-
axCursorType = detectCursorTypeUsingAccessibility(cursorPos);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
NSString *finalType = nil;
|
|
598
|
-
if (axCursorType && ![axCursorType isEqualToString:@"default"]) {
|
|
599
|
-
finalType = axCursorType;
|
|
600
|
-
} else if (systemCursorType && [systemCursorType length] > 0) {
|
|
601
|
-
// Prefer the system cursor when accessibility reports a generic value.
|
|
602
|
-
finalType = systemCursorType;
|
|
603
|
-
} else if (axCursorType && [axCursorType length] > 0) {
|
|
604
|
-
finalType = axCursorType;
|
|
605
|
-
} else {
|
|
606
|
-
finalType = @"default";
|
|
568
|
+
if (systemCursorType && [systemCursorType length] > 0) {
|
|
569
|
+
NSLog(@"🎯 FINAL CURSOR TYPE (System): %@", systemCursorType);
|
|
570
|
+
return systemCursorType;
|
|
607
571
|
}
|
|
608
|
-
|
|
609
|
-
NSLog(@"🎯 FINAL CURSOR TYPE: %@", finalType);
|
|
610
|
-
return finalType;
|
|
572
|
+
return @"default";
|
|
611
573
|
}
|
|
612
574
|
}
|
|
613
575
|
|
|
@@ -662,9 +624,6 @@ CGEventRef eventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef eve
|
|
|
662
624
|
NSTimeInterval timestamp = [currentDate timeIntervalSinceDate:g_trackingStartTime] * 1000; // milliseconds
|
|
663
625
|
NSTimeInterval unixTimeMs = [currentDate timeIntervalSince1970] * 1000; // unix timestamp in milliseconds
|
|
664
626
|
NSString *cursorType = getCursorType();
|
|
665
|
-
// Debug fields: capture raw AX and system cursor types
|
|
666
|
-
NSString *axTypeDbg = detectCursorTypeUsingAccessibility(location);
|
|
667
|
-
NSString *sysTypeDbg = detectSystemCursorType();
|
|
668
627
|
// (already captured above)
|
|
669
628
|
NSString *eventType = @"move";
|
|
670
629
|
|
|
@@ -698,9 +657,7 @@ CGEventRef eventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef eve
|
|
|
698
657
|
@"timestamp": @(timestamp),
|
|
699
658
|
@"unixTimeMs": @(unixTimeMs),
|
|
700
659
|
@"cursorType": cursorType,
|
|
701
|
-
@"type": eventType
|
|
702
|
-
@"axCursorType": axTypeDbg ? axTypeDbg : @"",
|
|
703
|
-
@"systemCursorType": sysTypeDbg ? sysTypeDbg : @""
|
|
660
|
+
@"type": eventType
|
|
704
661
|
};
|
|
705
662
|
|
|
706
663
|
// Direkt dosyaya yaz
|
|
@@ -733,9 +690,6 @@ void cursorTimerCallback() {
|
|
|
733
690
|
NSTimeInterval timestamp = [currentDate timeIntervalSinceDate:g_trackingStartTime] * 1000; // milliseconds
|
|
734
691
|
NSTimeInterval unixTimeMs = [currentDate timeIntervalSince1970] * 1000; // unix timestamp in milliseconds
|
|
735
692
|
NSString *cursorType = getCursorType();
|
|
736
|
-
// Debug fields: capture raw AX and system cursor types
|
|
737
|
-
NSString *axTypeDbg = detectCursorTypeUsingAccessibility(location);
|
|
738
|
-
NSString *sysTypeDbg = detectSystemCursorType();
|
|
739
693
|
|
|
740
694
|
// Cursor data oluştur
|
|
741
695
|
NSDictionary *cursorInfo = @{
|
|
@@ -744,9 +698,7 @@ void cursorTimerCallback() {
|
|
|
744
698
|
@"timestamp": @(timestamp),
|
|
745
699
|
@"unixTimeMs": @(unixTimeMs),
|
|
746
700
|
@"cursorType": cursorType,
|
|
747
|
-
@"type": @"move"
|
|
748
|
-
@"axCursorType": axTypeDbg ? axTypeDbg : @"",
|
|
749
|
-
@"systemCursorType": sysTypeDbg ? sysTypeDbg : @""
|
|
701
|
+
@"type": @"move"
|
|
750
702
|
};
|
|
751
703
|
|
|
752
704
|
// Direkt dosyaya yaz
|