node-mac-recorder 2.10.13 → 2.10.15
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 +1 -1
- package/src/window_selector.mm +49 -10
package/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -124,12 +124,21 @@ void updateScreenOverlays();
|
|
|
124
124
|
// Update global toggle state
|
|
125
125
|
g_hasToggledWindow = self.isToggled;
|
|
126
126
|
|
|
127
|
-
// Bring window to front if toggled
|
|
128
127
|
if (self.isToggled && self.windowInfo) {
|
|
128
|
+
// Toggle activated - bring window to front
|
|
129
129
|
int windowId = [[self.windowInfo objectForKey:@"id"] intValue];
|
|
130
130
|
if (windowId > 0) {
|
|
131
131
|
bringWindowToFront(windowId);
|
|
132
|
-
NSLog(@"🔄 TOGGLED: Window brought to front - %@", [self.windowInfo objectForKey:@"title"]);
|
|
132
|
+
NSLog(@"🔄 TOGGLED ON: Window brought to front - %@", [self.windowInfo objectForKey:@"title"]);
|
|
133
|
+
}
|
|
134
|
+
} else if (!self.isToggled) {
|
|
135
|
+
// Toggle deactivated - clear state and force overlay refresh
|
|
136
|
+
NSLog(@"🔄 TOGGLED OFF: Clearing lock state for fresh tracking");
|
|
137
|
+
|
|
138
|
+
// Force next overlay update by clearing current window data
|
|
139
|
+
if (g_currentWindowUnderCursor) {
|
|
140
|
+
[g_currentWindowUnderCursor release];
|
|
141
|
+
g_currentWindowUnderCursor = nil;
|
|
133
142
|
}
|
|
134
143
|
}
|
|
135
144
|
|
|
@@ -509,10 +518,25 @@ void updateOverlay() {
|
|
|
509
518
|
[NSPredicate predicateWithFormat:@"id == %d", toggledWindowId]] firstObject] : nil;
|
|
510
519
|
|
|
511
520
|
if (freshWindowData && ![freshWindowData isEqualToDictionary:g_currentWindowUnderCursor]) {
|
|
512
|
-
//
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
521
|
+
// Check if position change is significant enough to update
|
|
522
|
+
int oldX = [[g_currentWindowUnderCursor objectForKey:@"x"] intValue];
|
|
523
|
+
int oldY = [[g_currentWindowUnderCursor objectForKey:@"y"] intValue];
|
|
524
|
+
int newX = [[freshWindowData objectForKey:@"x"] intValue];
|
|
525
|
+
int newY = [[freshWindowData objectForKey:@"y"] intValue];
|
|
526
|
+
|
|
527
|
+
int deltaX = abs(newX - oldX);
|
|
528
|
+
int deltaY = abs(newY - oldY);
|
|
529
|
+
|
|
530
|
+
if (deltaX >= 5 || deltaY >= 5) {
|
|
531
|
+
// Significant position change - update
|
|
532
|
+
needsUpdate = YES;
|
|
533
|
+
targetWindow = freshWindowData;
|
|
534
|
+
NSLog(@"📍 TOGGLED WINDOW MOVED: (%d,%d) → (%d,%d)", oldX, oldY, newX, newY);
|
|
535
|
+
} else {
|
|
536
|
+
// Minor change - ignore to prevent flickering
|
|
537
|
+
needsUpdate = NO;
|
|
538
|
+
targetWindow = g_currentWindowUnderCursor;
|
|
539
|
+
}
|
|
516
540
|
} else {
|
|
517
541
|
// No change needed for toggled window
|
|
518
542
|
needsUpdate = NO;
|
|
@@ -538,10 +562,25 @@ void updateOverlay() {
|
|
|
538
562
|
[NSPredicate predicateWithFormat:@"id == %d", currentWindowId]] firstObject] : nil;
|
|
539
563
|
|
|
540
564
|
if (freshWindowData && ![freshWindowData isEqualToDictionary:g_currentWindowUnderCursor]) {
|
|
541
|
-
//
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
565
|
+
// Check if position change is significant enough to update
|
|
566
|
+
int oldX = [[g_currentWindowUnderCursor objectForKey:@"x"] intValue];
|
|
567
|
+
int oldY = [[g_currentWindowUnderCursor objectForKey:@"y"] intValue];
|
|
568
|
+
int newX = [[freshWindowData objectForKey:@"x"] intValue];
|
|
569
|
+
int newY = [[freshWindowData objectForKey:@"y"] intValue];
|
|
570
|
+
|
|
571
|
+
int deltaX = abs(newX - oldX);
|
|
572
|
+
int deltaY = abs(newY - oldY);
|
|
573
|
+
|
|
574
|
+
if (deltaX >= 5 || deltaY >= 5) {
|
|
575
|
+
// Significant position change - update
|
|
576
|
+
needsUpdate = YES;
|
|
577
|
+
targetWindow = freshWindowData;
|
|
578
|
+
NSLog(@"📍 WINDOW MOVED: (%d,%d) → (%d,%d)", oldX, oldY, newX, newY);
|
|
579
|
+
} else {
|
|
580
|
+
// Minor change - ignore to prevent flickering
|
|
581
|
+
needsUpdate = NO;
|
|
582
|
+
targetWindow = g_currentWindowUnderCursor;
|
|
583
|
+
}
|
|
545
584
|
} else {
|
|
546
585
|
targetWindow = g_currentWindowUnderCursor;
|
|
547
586
|
}
|