node-mac-recorder 2.6.5 → 2.6.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.6.5",
3
+ "version": "2.6.7",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -53,6 +53,7 @@ void updateScreenOverlays();
53
53
  // Custom overlay view class
54
54
  @interface WindowSelectorOverlayView : NSView
55
55
  @property (nonatomic, strong) NSDictionary *windowInfo;
56
+ @property (nonatomic) BOOL isActiveWindow;
56
57
  @end
57
58
 
58
59
  @implementation WindowSelectorOverlayView
@@ -65,6 +66,7 @@ void updateScreenOverlays();
65
66
  // Ensure no borders or decorations
66
67
  self.layer.borderWidth = 0.0;
67
68
  self.layer.cornerRadius = 0.0;
69
+ self.isActiveWindow = YES; // Default to active for current window under mouse
68
70
  }
69
71
  return self;
70
72
  }
@@ -74,12 +76,15 @@ void updateScreenOverlays();
74
76
 
75
77
  if (!self.windowInfo) return;
76
78
 
77
- // Background with transparency - purple tone (no border)
78
- [[NSColor colorWithRed:0.5 green:0.3 blue:0.8 alpha:0.25] setFill];
79
+ // Background with transparency - same style as screen overlay
80
+ if (self.isActiveWindow) {
81
+ // Active window: brighter, more opaque (same as active screen)
82
+ [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] setFill];
83
+ } else {
84
+ // Inactive window: dimmer, less opaque (same as inactive screen)
85
+ [[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.25] setFill];
86
+ }
79
87
  NSRectFill(self.bounds);
80
-
81
- // Ensure no borders or frames are drawn
82
- // Text will be handled by separate label above button
83
88
  }
84
89
 
85
90
  @end
@@ -175,13 +180,7 @@ void updateScreenOverlays();
175
180
  }
176
181
  NSRectFill(self.bounds);
177
182
 
178
- // Add subtle border for active screen
179
- if (self.isActiveScreen) {
180
- [[NSColor colorWithRed:0.7 green:0.5 blue:1.0 alpha:0.6] setStroke];
181
- NSBezierPath *borderPath = [NSBezierPath bezierPathWithRect:NSInsetRect(self.bounds, 2, 2)];
182
- [borderPath setLineWidth:4.0];
183
- [borderPath stroke];
184
- }
183
+ // No border for clean look
185
184
  }
186
185
 
187
186
  @end
@@ -472,10 +471,13 @@ void updateOverlay() {
472
471
  if (!windowScreen) windowScreen = [NSScreen mainScreen];
473
472
 
474
473
  // Convert coordinates from CGWindow (top-left) to NSWindow (bottom-left) for the specific screen
475
- CGFloat screenHeight = [windowScreen frame].size.height;
474
+ NSRect screenFrame = [windowScreen frame];
475
+ CGFloat screenHeight = screenFrame.size.height;
476
476
  CGFloat adjustedY = screenHeight - y - height;
477
477
 
478
- // Use actual window coordinates without clamping to preserve overlay accuracy
478
+ // Window coordinates are in global space, overlay frame should be screen-relative
479
+ // Keep X coordinate as-is (already in global space which is what we want)
480
+ // Only convert Y from top-left to bottom-left coordinate system
479
481
  NSRect overlayFrame = NSMakeRect(x, adjustedY, width, height);
480
482
 
481
483
  NSString *windowTitle = [windowUnderCursor objectForKey:@"title"] ?: @"Untitled";
@@ -943,12 +945,24 @@ bool startScreenSelection() {
943
945
  [screenInfoArray addObject:screenInfo];
944
946
 
945
947
  // Create overlay window for this screen (FULL screen including menu bar)
946
- // IMPORTANT: Explicitly assign to specific screen
947
- NSWindow *overlayWindow = [[NSWindow alloc] initWithContentRect:screenFrame
948
- styleMask:NSWindowStyleMaskBorderless
949
- backing:NSBackingStoreBuffered
950
- defer:NO
951
- screen:screen];
948
+ // For secondary screens, don't specify screen parameter to avoid issues
949
+ NSWindow *overlayWindow;
950
+ if (i == 0) {
951
+ // Primary screen - use screen parameter
952
+ overlayWindow = [[NSWindow alloc] initWithContentRect:screenFrame
953
+ styleMask:NSWindowStyleMaskBorderless
954
+ backing:NSBackingStoreBuffered
955
+ defer:NO
956
+ screen:screen];
957
+ } else {
958
+ // Secondary screens - create without screen param, set frame manually
959
+ overlayWindow = [[NSWindow alloc] initWithContentRect:screenFrame
960
+ styleMask:NSWindowStyleMaskBorderless
961
+ backing:NSBackingStoreBuffered
962
+ defer:NO];
963
+ // Force specific positioning for secondary screen
964
+ [overlayWindow setFrameOrigin:screenFrame.origin];
965
+ }
952
966
 
953
967
  // Window created for specific screen
954
968
 
@@ -1126,17 +1140,23 @@ bool startScreenSelection() {
1126
1140
  // Ensure window frame is correct for this screen
1127
1141
  [overlayWindow setFrame:screenFrame display:YES animate:NO];
1128
1142
 
1129
- // Show overlay - for secondary screens, avoid makeKeyAndOrderFront initially
1143
+ // Show overlay - different strategy for secondary screens
1130
1144
  if (i == 0) {
1131
- // Primary screen - can be key window
1145
+ // Primary screen
1132
1146
  [overlayWindow makeKeyAndOrderFront:nil];
1147
+ // Primary screen overlay shown
1133
1148
  } else {
1134
- // Secondary screens - just order front first
1149
+ // Secondary screens - more aggressive approach
1135
1150
  [overlayWindow orderFront:nil];
1136
- // Small delay to ensure window is created on correct screen
1137
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
1151
+ [overlayWindow makeKeyAndOrderFront:nil]; // Try makeKey too
1152
+ [overlayWindow setLevel:CGWindowLevelForKey(kCGFloatingWindowLevelKey) + 2000]; // Even higher level
1153
+
1154
+ // Secondary screen overlay shown
1155
+
1156
+ // Double-check with delayed re-show
1157
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
1138
1158
  [overlayWindow orderFront:nil];
1139
- [overlayWindow setOrderedIndex:0]; // Bring to very front
1159
+ [overlayWindow makeKeyAndOrderFront:nil];
1140
1160
  });
1141
1161
  }
1142
1162