node-mac-recorder 2.10.12 → 2.10.14

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.12",
3
+ "version": "2.10.14",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -501,33 +501,43 @@ void updateOverlay() {
501
501
  if (windowUnderCursor) {
502
502
  // Check if we're in lock mode (toggled window)
503
503
  if (g_hasToggledWindow && g_currentWindowUnderCursor) {
504
- // Check if cursor moved to different window while locked
504
+ // In lock mode - only track toggled window position, ignore cursor
505
505
  int toggledWindowId = [[g_currentWindowUnderCursor objectForKey:@"id"] intValue];
506
- int cursorWindowId = [[windowUnderCursor objectForKey:@"id"] intValue];
506
+ NSArray *allWindows = getAllSelectableWindows();
507
+ NSDictionary *freshWindowData = allWindows ?
508
+ [[allWindows filteredArrayUsingPredicate:
509
+ [NSPredicate predicateWithFormat:@"id == %d", toggledWindowId]] firstObject] : nil;
507
510
 
508
- if (toggledWindowId != cursorWindowId) {
509
- // Cursor moved to different window - cancel toggle and switch to new window
510
- NSLog(@"🔓 TOGGLE CANCELLED: Cursor moved to different window");
511
- g_hasToggledWindow = NO;
512
- needsUpdate = YES;
513
- targetWindow = windowUnderCursor;
514
- } else {
515
- // Same window - check for position changes
516
- NSArray *allWindows = getAllSelectableWindows();
517
- NSDictionary *freshWindowData = allWindows ?
518
- [[allWindows filteredArrayUsingPredicate:
519
- [NSPredicate predicateWithFormat:@"id == %d", toggledWindowId]] firstObject] : nil;
511
+ if (freshWindowData && ![freshWindowData isEqualToDictionary:g_currentWindowUnderCursor]) {
512
+ // Check if position change is significant enough to update
513
+ int oldX = [[g_currentWindowUnderCursor objectForKey:@"x"] intValue];
514
+ int oldY = [[g_currentWindowUnderCursor objectForKey:@"y"] intValue];
515
+ int newX = [[freshWindowData objectForKey:@"x"] intValue];
516
+ int newY = [[freshWindowData objectForKey:@"y"] intValue];
517
+
518
+ int deltaX = abs(newX - oldX);
519
+ int deltaY = abs(newY - oldY);
520
520
 
521
- if (freshWindowData && ![freshWindowData isEqualToDictionary:g_currentWindowUnderCursor]) {
522
- // Toggled window position changed - update
521
+ if (deltaX >= 3 || deltaY >= 3) {
522
+ // Significant position change - update
523
523
  needsUpdate = YES;
524
524
  targetWindow = freshWindowData;
525
- NSLog(@"📍 TOGGLED WINDOW MOVED: Updating overlay position");
525
+ NSLog(@"📍 TOGGLED WINDOW MOVED: (%d,%d) (%d,%d)", oldX, oldY, newX, newY);
526
526
  } else {
527
- // No change needed
527
+ // Minor change - ignore to prevent flickering
528
528
  needsUpdate = NO;
529
529
  targetWindow = g_currentWindowUnderCursor;
530
530
  }
531
+ } else {
532
+ // No change needed for toggled window
533
+ needsUpdate = NO;
534
+ targetWindow = g_currentWindowUnderCursor;
535
+ }
536
+
537
+ // Log cursor movement but don't act on it
538
+ int cursorWindowId = [[windowUnderCursor objectForKey:@"id"] intValue];
539
+ if (toggledWindowId != cursorWindowId) {
540
+ NSLog(@"🔒 LOCK ACTIVE: Cursor on different window but keeping toggle");
531
541
  }
532
542
  } else if (!g_currentWindowUnderCursor ||
533
543
  ![windowUnderCursor isEqualToDictionary:g_currentWindowUnderCursor]) {
@@ -543,10 +553,25 @@ void updateOverlay() {
543
553
  [NSPredicate predicateWithFormat:@"id == %d", currentWindowId]] firstObject] : nil;
544
554
 
545
555
  if (freshWindowData && ![freshWindowData isEqualToDictionary:g_currentWindowUnderCursor]) {
546
- // Same window but position/size changed
547
- needsUpdate = YES;
548
- targetWindow = freshWindowData;
549
- NSLog(@"📍 WINDOW MOVED: Updating overlay position");
556
+ // Check if position change is significant enough to update
557
+ int oldX = [[g_currentWindowUnderCursor objectForKey:@"x"] intValue];
558
+ int oldY = [[g_currentWindowUnderCursor objectForKey:@"y"] intValue];
559
+ int newX = [[freshWindowData objectForKey:@"x"] intValue];
560
+ int newY = [[freshWindowData objectForKey:@"y"] intValue];
561
+
562
+ int deltaX = abs(newX - oldX);
563
+ int deltaY = abs(newY - oldY);
564
+
565
+ if (deltaX >= 3 || deltaY >= 3) {
566
+ // Significant position change - update
567
+ needsUpdate = YES;
568
+ targetWindow = freshWindowData;
569
+ NSLog(@"📍 WINDOW MOVED: (%d,%d) → (%d,%d)", oldX, oldY, newX, newY);
570
+ } else {
571
+ // Minor change - ignore to prevent flickering
572
+ needsUpdate = NO;
573
+ targetWindow = g_currentWindowUnderCursor;
574
+ }
550
575
  } else {
551
576
  targetWindow = g_currentWindowUnderCursor;
552
577
  }