node-mac-recorder 2.20.13 → 2.20.15

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.
@@ -4,7 +4,8 @@
4
4
  "Bash(node-gyp:*)",
5
5
  "Bash(node:*)",
6
6
  "Bash(timeout:*)",
7
- "Bash(open:*)"
7
+ "Bash(open:*)",
8
+ "Read(//Users/onur/codes/**)"
8
9
  ],
9
10
  "deny": [],
10
11
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.20.13",
3
+ "version": "2.20.15",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -751,17 +751,16 @@ NSString* getCursorType() {
751
751
 
752
752
  NSString *finalType = @"default";
753
753
 
754
- // SYSTEM CURSOR FIRST - more reliable for visual state
755
- // Always trust system cursor first, only use AX for very specific cases
754
+
755
+ // SYSTEM CURSOR PRIORITY - trust visual state over accessibility
756
756
  if (systemCursorType && [systemCursorType length] > 0) {
757
- // Only override system cursor with AX if system is "default" AND AX gives us text/resize
757
+ // ALWAYS use system cursor when available - it reflects visual state
758
+ finalType = systemCursorType;
759
+
760
+ // Special case: Only use AX for resize cursors that system can't detect
758
761
  if ([systemCursorType isEqualToString:@"default"] && axCursorType &&
759
- ([axCursorType isEqualToString:@"text"] ||
760
- [axCursorType containsString:@"resize"] ||
761
- [axCursorType isEqualToString:@"crosshair"])) {
762
+ [axCursorType containsString:@"resize"]) {
762
763
  finalType = axCursorType;
763
- } else {
764
- finalType = systemCursorType;
765
764
  }
766
765
  }
767
766
  // Only if system completely fails, use AX
@@ -56,6 +56,70 @@ static id g_screenKeyEventMonitor = nil;
56
56
  static NSTimer *g_screenTrackingTimer = nil;
57
57
  static NSInteger g_currentActiveScreenIndex = -1;
58
58
 
59
+ // Record icon helpers
60
+ static NSImage *CreateRecordIconImage(CGFloat size) {
61
+ NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(size, size)] autorelease];
62
+ if (!image) {
63
+ return nil;
64
+ }
65
+
66
+ [image lockFocus];
67
+
68
+ [[NSColor clearColor] setFill];
69
+ NSRectFill(NSMakeRect(0, 0, size, size));
70
+
71
+ CGFloat strokeWidth = MAX(2.0, size * 0.12);
72
+ NSRect outerRect = NSMakeRect(strokeWidth / 2.0,
73
+ strokeWidth / 2.0,
74
+ size - strokeWidth,
75
+ size - strokeWidth);
76
+ NSBezierPath *outerPath = [NSBezierPath bezierPathWithOvalInRect:outerRect];
77
+ [outerPath setLineWidth:strokeWidth];
78
+ [[NSColor whiteColor] setStroke];
79
+ [outerPath stroke];
80
+
81
+ CGFloat innerDiameter = size * 0.45;
82
+ NSRect innerRect = NSMakeRect((size - innerDiameter) / 2.0,
83
+ (size - innerDiameter) / 2.0,
84
+ innerDiameter,
85
+ innerDiameter);
86
+ NSBezierPath *innerPath = [NSBezierPath bezierPathWithOvalInRect:innerRect];
87
+ [[NSColor whiteColor] setFill];
88
+ [innerPath fill];
89
+
90
+ [image unlockFocus];
91
+ [image setTemplate:NO];
92
+
93
+ return image;
94
+ }
95
+
96
+ static NSImage *GetStartRecordIcon(void) {
97
+ static NSImage *recordIcon = nil;
98
+ if (!recordIcon) {
99
+ recordIcon = [CreateRecordIconImage(18.0) retain];
100
+ }
101
+ return recordIcon;
102
+ }
103
+
104
+ static void ApplyStartRecordButtonIcon(NSButton *button) {
105
+ if (!button) {
106
+ return;
107
+ }
108
+
109
+ NSImage *icon = GetStartRecordIcon();
110
+ if (!icon) {
111
+ return;
112
+ }
113
+
114
+ [button setImage:icon];
115
+ [button setImageScaling:NSImageScaleNone];
116
+ [button setImagePosition:NSImageLeft];
117
+
118
+ if ([button respondsToSelector:@selector(setContentTintColor:)]) {
119
+ [button setContentTintColor:[NSColor whiteColor]];
120
+ }
121
+ }
122
+
59
123
  // Forward declarations
60
124
  void cleanupWindowSelector();
61
125
  void updateOverlay();
@@ -1133,7 +1197,9 @@ void updateOverlay() {
1133
1197
  [targetOverlay.contentView addSubview:targetSelectButton];
1134
1198
  NSLog(@"🆕 Added new button to Screen %ld overlay - total subviews now: %lu", targetScreenIndex, [targetOverlay.contentView subviews].count);
1135
1199
  }
1136
-
1200
+
1201
+ ApplyStartRecordButtonIcon(targetSelectButton);
1202
+
1137
1203
  // Position buttons - Start Record in center of selected window
1138
1204
  if (targetSelectButton) {
1139
1205
  NSLog(@"🎯 Positioning button on Screen %ld - current frame: (%.0f,%.0f,%.0f,%.0f)", targetScreenIndex,
@@ -1736,9 +1802,11 @@ bool startScreenSelection() {
1736
1802
  value:[NSColor whiteColor]
1737
1803
  range:NSMakeRange(0, [titleString length])];
1738
1804
  [selectButton setAttributedTitle:titleString];
1739
-
1805
+
1806
+ ApplyStartRecordButtonIcon(selectButton);
1807
+
1740
1808
  // Clean button - no shadows or highlights
1741
-
1809
+
1742
1810
  // Set button target and action (reuse global delegate)
1743
1811
  if (!g_delegate) {
1744
1812
  g_delegate = [[WindowSelectorDelegate alloc] init];
@@ -2217,7 +2285,9 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
2217
2285
  value:[NSColor whiteColor]
2218
2286
  range:NSMakeRange(0, [titleString length])];
2219
2287
  [g_selectButton setAttributedTitle:titleString];
2220
-
2288
+
2289
+ ApplyStartRecordButtonIcon(g_selectButton);
2290
+
2221
2291
  // Create delegate for button action and timer
2222
2292
  g_delegate = [[WindowSelectorDelegate alloc] init];
2223
2293
  [g_selectButton setTarget:g_delegate];
@@ -2743,4 +2813,3 @@ extern "C" void showOverlays() {
2743
2813
  }
2744
2814
  });
2745
2815
  }
2746
-