node-mac-recorder 2.9.2 → 2.10.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -17,8 +17,7 @@ static NSView *g_overlayView = nil;
17
17
  static WindowSelectorOverlayView *g_selectedOverlayView = nil; // Track selected overlay
18
18
  static NSButton *g_selectButton = nil;
19
19
  static NSTimer *g_trackingTimer = nil;
20
- static NSDictionary *g_selectedWindowInfo = nil; // Window info for recording
21
- static NSDictionary *g_clickedWindowInfo = nil; // Separate state for clicked selection (NOT for recording)
20
+ static NSDictionary *g_selectedWindowInfo = nil;
22
21
  static NSMutableArray *g_allWindows = nil;
23
22
  static NSDictionary *g_currentWindowUnderCursor = nil;
24
23
  static bool g_bringToFrontEnabled = true; // Default enabled
@@ -81,25 +80,25 @@ void updateScreenOverlays();
81
80
  }
82
81
 
83
82
  - (void)updateAppearance {
84
- if (self.isSelectedWindow) {
85
- // Selected window: same background but medium border (2px)
86
- self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor]; // Same as highlight
87
- self.layer.borderColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:1.0] CGColor];
88
- self.layer.borderWidth = 2.0; // Medium border for selected window
89
- // Selected window appearance set
90
- } else if (self.isActiveWindow) {
91
- // Active window (highlighted): thin border (1px)
92
- self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor];
93
- self.layer.borderColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.8] CGColor];
94
- self.layer.borderWidth = 1.0; // Thin border for highlighted window
95
- // Active window appearance set
96
- } else {
97
- // Inactive window: no border
98
- self.layer.backgroundColor = [[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.25] CGColor];
99
- self.layer.borderColor = [[NSColor clearColor] CGColor];
100
- self.layer.borderWidth = 0.0; // No border for inactive window
101
- // Inactive window appearance set
102
- }
83
+ if (self.isSelectedWindow) {
84
+ // Selected window: same background but thick border (3px)
85
+ self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor]; // Same as highlight
86
+ self.layer.borderColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:1.0] CGColor];
87
+ self.layer.borderWidth = 3.0; // Thick border for selected window
88
+ // Selected window appearance set
89
+ } else if (self.isActiveWindow) {
90
+ // Active window (highlighted): thin border (1px)
91
+ self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor];
92
+ self.layer.borderColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.8] CGColor];
93
+ self.layer.borderWidth = 1.0; // Thin border for highlighted window
94
+ // Active window appearance set
95
+ } else {
96
+ // Inactive window: no border
97
+ self.layer.backgroundColor = [[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.25] CGColor];
98
+ self.layer.borderColor = [[NSColor clearColor] CGColor];
99
+ self.layer.borderWidth = 0.0; // No border for inactive window
100
+ // Inactive window appearance set
101
+ }
103
102
 
104
103
  // Common styling
105
104
  self.layer.cornerRadius = 8.0;
@@ -127,17 +126,17 @@ void updateScreenOverlays();
127
126
  // Handle mouse click to toggle window selection (ONLY selection, no recording start)
128
127
  if (self.windowInfo) {
129
128
  // Check if this window is already selected
130
- BOOL wasSelected = (g_clickedWindowInfo &&
131
- [g_clickedWindowInfo isEqualToDictionary:self.windowInfo]);
129
+ BOOL wasSelected = (g_selectedWindowInfo &&
130
+ [g_selectedWindowInfo isEqualToDictionary:self.windowInfo]);
132
131
 
133
132
  if (wasSelected) {
134
133
  // Deselect this window - return to normal highlight behavior
135
134
  self.isSelectedWindow = NO;
136
135
 
137
- // Clear global clicked selection (NOT recording selection)
138
- if (g_clickedWindowInfo) {
139
- [g_clickedWindowInfo release];
140
- g_clickedWindowInfo = nil;
136
+ // Clear global selection
137
+ if (g_selectedWindowInfo) {
138
+ [g_selectedWindowInfo release];
139
+ g_selectedWindowInfo = nil;
141
140
  }
142
141
  g_selectedOverlayView = nil;
143
142
 
@@ -151,19 +150,19 @@ void updateScreenOverlays();
151
150
  [g_selectedOverlayView updateAppearance];
152
151
  }
153
152
 
154
- // Select this window (for visual selection only, NOT for recording)
153
+ // Select this window
155
154
  self.isSelectedWindow = YES;
156
155
 
157
- // Update global clicked window info (separate from recording selection)
158
- if (g_clickedWindowInfo) {
159
- [g_clickedWindowInfo release];
156
+ // Update global selected window info
157
+ if (g_selectedWindowInfo) {
158
+ [g_selectedWindowInfo release];
160
159
  }
161
- g_clickedWindowInfo = [self.windowInfo retain];
160
+ g_selectedWindowInfo = [self.windowInfo retain];
162
161
 
163
162
  // Update global selected overlay reference
164
163
  g_selectedOverlayView = self;
165
164
 
166
- NSLog(@"🎯 WINDOW CLICKED - Visual selection only (NOT recording): %@ - \"%@\"",
165
+ NSLog(@"🎯 WINDOW SELECTED - Highlight blocked on this window: %@ - \"%@\"",
167
166
  [self.windowInfo objectForKey:@"appName"] ?: @"Unknown",
168
167
  [self.windowInfo objectForKey:@"title"] ?: @"Untitled");
169
168
  }
@@ -172,12 +171,6 @@ void updateScreenOverlays();
172
171
  [self updateAppearance];
173
172
 
174
173
  // DON'T start recording here - that's only for the "Start Record" button
175
- // Consume the event completely to prevent any propagation
176
- NSLog(@"🛑 MOUSE EVENT CONSUMED - No recording started");
177
-
178
- // IMPORTANT: Return YES to indicate we handled the event
179
- // This prevents the event from propagating to other handlers
180
- return;
181
174
  }
182
175
  }
183
176
 
@@ -299,19 +292,14 @@ void updateScreenOverlays();
299
292
 
300
293
  @implementation WindowSelectorDelegate
301
294
  - (void)selectButtonClicked:(id)sender {
302
- if (g_clickedWindowInfo) {
303
- // Copy clicked window info to recording selection
304
- if (g_selectedWindowInfo) {
305
- [g_selectedWindowInfo release];
306
- }
307
- g_selectedWindowInfo = [g_clickedWindowInfo retain];
308
-
309
- NSLog(@"🎯 START RECORDING: Clicked window confirmed for recording - %@ - \"%@\"",
295
+ if (g_selectedWindowInfo) {
296
+ // Use the selected window info (from click) instead of cursor position
297
+ NSLog(@"🎯 START RECORDING: Selected window confirmed - %@ - \"%@\"",
310
298
  [g_selectedWindowInfo objectForKey:@"appName"] ?: @"Unknown",
311
299
  [g_selectedWindowInfo objectForKey:@"title"] ?: @"Untitled");
312
300
  cleanupWindowSelector();
313
301
  } else {
314
- NSLog(@"⚠️ No window clicked - cannot start recording");
302
+ NSLog(@"⚠️ No window selected - cannot start recording");
315
303
  }
316
304
  }
317
305
 
@@ -812,9 +800,9 @@ void updateOverlay() {
812
800
  BOOL isUnderCursor = (windowUnderCursor &&
813
801
  [g_currentWindowUnderCursor isEqualToDictionary:windowUnderCursor]);
814
802
 
815
- // Check if this is the clicked window (visual selection)
816
- BOOL isSelected = (g_clickedWindowInfo &&
817
- [g_clickedWindowInfo isEqualToDictionary:windowUnderCursor]);
803
+ // Check if this is the selected window
804
+ BOOL isSelected = (g_selectedWindowInfo &&
805
+ [g_selectedWindowInfo isEqualToDictionary:windowUnderCursor]);
818
806
 
819
807
  // Allow highlighting on all windows (including selected) but keep selection state
820
808
  overlayView.isActiveWindow = isUnderCursor; // Highlight if under cursor
@@ -867,18 +855,6 @@ void cleanupWindowSelector() {
867
855
  g_selectedOverlayView.isSelectedWindow = NO;
868
856
  g_selectedOverlayView = nil;
869
857
  }
870
-
871
- // Clear clicked window info (visual selection)
872
- if (g_clickedWindowInfo) {
873
- [g_clickedWindowInfo release];
874
- g_clickedWindowInfo = nil;
875
- }
876
-
877
- // Clear selected window info (recording selection)
878
- if (g_selectedWindowInfo) {
879
- [g_selectedWindowInfo release];
880
- g_selectedWindowInfo = nil;
881
- }
882
858
  }
883
859
 
884
860
  // Recording preview functions
@@ -1561,10 +1537,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1561
1537
  [g_selectedWindowInfo release];
1562
1538
  g_selectedWindowInfo = nil;
1563
1539
  }
1564
- if (g_clickedWindowInfo) {
1565
- [g_clickedWindowInfo release];
1566
- g_clickedWindowInfo = nil;
1567
- }
1568
1540
  if (g_selectedOverlayView) {
1569
1541
  g_selectedOverlayView.isSelectedWindow = NO;
1570
1542
  g_selectedOverlayView = nil;
@@ -1839,8 +1811,9 @@ Napi::Value GetSelectedWindowInfo(const Napi::CallbackInfo& info) {
1839
1811
  result.Set("screenWidth", Napi::Number::New(env, (int)screenFrame.size.width));
1840
1812
  result.Set("screenHeight", Napi::Number::New(env, (int)screenFrame.size.height));
1841
1813
 
1842
- // Don't clear selected window info - just read it
1843
- // The info will be cleared when recording actually starts
1814
+ // Clear selected window info after reading
1815
+ [g_selectedWindowInfo release];
1816
+ g_selectedWindowInfo = nil;
1844
1817
 
1845
1818
  return result;
1846
1819