node-mac-recorder 2.9.1 → 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.1",
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
@@ -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,12 +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
858
  }
877
859
 
878
860
  // Recording preview functions
@@ -1555,10 +1537,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1555
1537
  [g_selectedWindowInfo release];
1556
1538
  g_selectedWindowInfo = nil;
1557
1539
  }
1558
- if (g_clickedWindowInfo) {
1559
- [g_clickedWindowInfo release];
1560
- g_clickedWindowInfo = nil;
1561
- }
1562
1540
  if (g_selectedOverlayView) {
1563
1541
  g_selectedOverlayView.isSelectedWindow = NO;
1564
1542
  g_selectedOverlayView = nil;
@@ -1833,8 +1811,9 @@ Napi::Value GetSelectedWindowInfo(const Napi::CallbackInfo& info) {
1833
1811
  result.Set("screenWidth", Napi::Number::New(env, (int)screenFrame.size.width));
1834
1812
  result.Set("screenHeight", Napi::Number::New(env, (int)screenFrame.size.height));
1835
1813
 
1836
- // Don't clear selected window info - just read it
1837
- // The info will be cleared when recording actually starts
1814
+ // Clear selected window info after reading
1815
+ [g_selectedWindowInfo release];
1816
+ g_selectedWindowInfo = nil;
1838
1817
 
1839
1818
  return result;
1840
1819