node-mac-recorder 2.10.5 → 2.10.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -17,6 +17,7 @@ static NSDictionary *g_selectedWindowInfo = nil;
17
17
  static NSMutableArray *g_allWindows = nil;
18
18
  static NSDictionary *g_currentWindowUnderCursor = nil;
19
19
  static bool g_bringToFrontEnabled = false; // Default disabled for overlay-only highlighting
20
+ static bool g_hasToggledWindow = false; // Track if any window is currently toggled
20
21
  static id g_windowKeyEventMonitor = nil;
21
22
 
22
23
  // Recording preview overlay state
@@ -120,6 +121,9 @@ void updateScreenOverlays();
120
121
  // Toggle the window state
121
122
  self.isToggled = !self.isToggled;
122
123
 
124
+ // Update global toggle state
125
+ g_hasToggledWindow = self.isToggled;
126
+
123
127
  // Bring window to front if toggled
124
128
  if (self.isToggled && self.windowInfo) {
125
129
  int windowId = [[self.windowInfo objectForKey:@"id"] intValue];
@@ -128,6 +132,8 @@ void updateScreenOverlays();
128
132
  NSLog(@"🔄 TOGGLED: Window brought to front - %@", [self.windowInfo objectForKey:@"title"]);
129
133
  }
130
134
  }
135
+
136
+ NSLog(@"🎯 Global toggle state: %s", g_hasToggledWindow ? "HAS_TOGGLED" : "NO_TOGGLE");
131
137
  }
132
138
 
133
139
  // Layer-based approach, no custom drawing needed
@@ -489,6 +495,15 @@ void updateOverlay() {
489
495
  NSDictionary *windowUnderCursor = getWindowUnderCursor(globalPoint);
490
496
 
491
497
  if (windowUnderCursor && ![windowUnderCursor isEqualToDictionary:g_currentWindowUnderCursor]) {
498
+ // If there's a toggled window, don't switch to a different window
499
+ if (g_hasToggledWindow && g_currentWindowUnderCursor) {
500
+ // Check if current toggled window is different from window under cursor
501
+ BOOL isSameWindow = [[g_currentWindowUnderCursor objectForKey:@"id"] isEqual:[windowUnderCursor objectForKey:@"id"]];
502
+ if (!isSameWindow) {
503
+ NSLog(@"🔒 BLOCKED: Not switching overlay - current window is toggled");
504
+ return; // Don't update overlay for different window
505
+ }
506
+ }
492
507
  // Update current window
493
508
  [g_currentWindowUnderCursor release];
494
509
  g_currentWindowUnderCursor = [windowUnderCursor retain];
@@ -560,6 +575,7 @@ void updateOverlay() {
560
575
  // Update overlay view window info and reset toggle state for new window
561
576
  [(WindowSelectorOverlayView *)g_overlayView setWindowInfo:windowUnderCursor];
562
577
  [(WindowSelectorOverlayView *)g_overlayView setIsToggled:NO];
578
+ g_hasToggledWindow = NO; // Reset global toggle state when switching windows
563
579
 
564
580
  // Add/update info label above button
565
581
  NSTextField *infoLabel = nil;
@@ -746,6 +762,7 @@ void updateOverlay() {
746
762
  // Cleanup function
747
763
  void cleanupWindowSelector() {
748
764
  g_isWindowSelecting = false;
765
+ g_hasToggledWindow = false; // Reset toggle state
749
766
 
750
767
  // Stop tracking timer
751
768
  if (g_trackingTimer) {