node-mac-recorder 2.16.26 → 2.16.27

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.
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Bash(FORCE_AVFOUNDATION=1 node test-sequential.js)"
4
+ "Bash(FORCE_AVFOUNDATION=1 node test-sequential.js)",
5
+ "Bash(grep:*)"
5
6
  ],
6
7
  "deny": [],
7
8
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.16.26",
3
+ "version": "2.16.27",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -475,8 +475,45 @@ void updateScreenOverlays();
475
475
  NSLog(@"🔥 Current window under cursor: %@", g_currentWindowUnderCursor);
476
476
 
477
477
  if (g_currentWindowUnderCursor) {
478
- g_selectedWindowInfo = [g_currentWindowUnderCursor retain];
479
- NSLog(@"🔥 Selected window info set: %@", g_selectedWindowInfo);
478
+ // Get window's screen information for display ID
479
+ NSMutableDictionary *windowInfoWithDisplay = [g_currentWindowUnderCursor mutableCopy];
480
+
481
+ // Get window bounds to determine which screen it's on
482
+ NSNumber *windowX = [g_currentWindowUnderCursor objectForKey:@"x"];
483
+ NSNumber *windowY = [g_currentWindowUnderCursor objectForKey:@"y"];
484
+
485
+ if (windowX && windowY) {
486
+ CGFloat x = [windowX doubleValue];
487
+ CGFloat y = [windowY doubleValue];
488
+
489
+ // Find the display that contains this window
490
+ CGDirectDisplayID activeDisplays[32];
491
+ uint32_t displayCount;
492
+ CGGetActiveDisplayList(32, activeDisplays, &displayCount);
493
+
494
+ CGDirectDisplayID targetDisplayID = 0;
495
+ for (uint32_t i = 0; i < displayCount; i++) {
496
+ CGDirectDisplayID displayID = activeDisplays[i];
497
+ CGRect displayBounds = CGDisplayBounds(displayID);
498
+
499
+ // Check if window center is within this display
500
+ if (x >= displayBounds.origin.x && x < displayBounds.origin.x + displayBounds.size.width &&
501
+ y >= displayBounds.origin.y && y < displayBounds.origin.y + displayBounds.size.height) {
502
+ targetDisplayID = displayID;
503
+ break;
504
+ }
505
+ }
506
+
507
+ if (targetDisplayID != 0) {
508
+ [windowInfoWithDisplay setObject:@(targetDisplayID) forKey:@"screenId"];
509
+ NSLog(@"🎯 Window on display ID: %u", targetDisplayID);
510
+ } else {
511
+ NSLog(@"⚠️ Could not determine display ID for window");
512
+ }
513
+ }
514
+
515
+ g_selectedWindowInfo = [windowInfoWithDisplay retain];
516
+ NSLog(@"🔥 Selected window info with display ID: %@", g_selectedWindowInfo);
480
517
  cleanupWindowSelector();
481
518
  } else {
482
519
  NSLog(@"⚠️ No window under cursor when button clicked!");