node-mac-recorder 2.4.2 → 2.4.4
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.
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
package/src/window_selector.mm
CHANGED
|
@@ -443,6 +443,11 @@ NSDictionary* getWindowUnderCursor(CGPoint point) {
|
|
|
443
443
|
|
|
444
444
|
// Update overlay to highlight window under cursor
|
|
445
445
|
void updateOverlay() {
|
|
446
|
+
// Ensure AppKit usage on main thread
|
|
447
|
+
if (![NSThread isMainThread]) {
|
|
448
|
+
dispatch_async(dispatch_get_main_queue(), ^{ updateOverlay(); });
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
446
451
|
@autoreleasepool {
|
|
447
452
|
if (!g_isWindowSelecting || !g_overlayWindow) return;
|
|
448
453
|
|
|
@@ -556,6 +561,10 @@ void updateOverlay() {
|
|
|
556
561
|
|
|
557
562
|
// Cleanup function
|
|
558
563
|
void cleanupWindowSelector() {
|
|
564
|
+
if (![NSThread isMainThread]) {
|
|
565
|
+
dispatch_async(dispatch_get_main_queue(), ^{ cleanupWindowSelector(); });
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
559
568
|
g_isWindowSelecting = false;
|
|
560
569
|
|
|
561
570
|
// Stop tracking timer
|
|
@@ -595,6 +604,10 @@ void cleanupWindowSelector() {
|
|
|
595
604
|
|
|
596
605
|
// Recording preview functions
|
|
597
606
|
void cleanupRecordingPreview() {
|
|
607
|
+
if (![NSThread isMainThread]) {
|
|
608
|
+
dispatch_async(dispatch_get_main_queue(), ^{ cleanupRecordingPreview(); });
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
598
611
|
if (g_recordingPreviewWindow) {
|
|
599
612
|
[g_recordingPreviewWindow close];
|
|
600
613
|
g_recordingPreviewWindow = nil;
|
|
@@ -674,6 +687,10 @@ bool hideRecordingPreview() {
|
|
|
674
687
|
|
|
675
688
|
// Screen selection functions
|
|
676
689
|
void cleanupScreenSelector() {
|
|
690
|
+
if (![NSThread isMainThread]) {
|
|
691
|
+
dispatch_async(dispatch_get_main_queue(), ^{ cleanupScreenSelector(); });
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
677
694
|
g_isScreenSelecting = false;
|
|
678
695
|
|
|
679
696
|
// Remove key event monitor
|
|
@@ -699,7 +716,13 @@ void cleanupScreenSelector() {
|
|
|
699
716
|
bool startScreenSelection() {
|
|
700
717
|
@try {
|
|
701
718
|
if (g_isScreenSelecting) return false;
|
|
702
|
-
|
|
719
|
+
// Force to main thread
|
|
720
|
+
if (![NSThread isMainThread]) {
|
|
721
|
+
__block BOOL ok = NO;
|
|
722
|
+
dispatch_sync(dispatch_get_main_queue(), ^{ ok = startScreenSelection(); });
|
|
723
|
+
return ok;
|
|
724
|
+
}
|
|
725
|
+
|
|
703
726
|
// Get all available screens
|
|
704
727
|
NSArray *screens = [NSScreen screens];
|
|
705
728
|
if (!screens || [screens count] == 0) return false;
|
|
@@ -861,9 +884,12 @@ bool startScreenSelection() {
|
|
|
861
884
|
bool stopScreenSelection() {
|
|
862
885
|
@try {
|
|
863
886
|
if (!g_isScreenSelecting) return false;
|
|
864
|
-
|
|
887
|
+
if (![NSThread isMainThread]) {
|
|
888
|
+
__block BOOL ok = NO;
|
|
889
|
+
dispatch_sync(dispatch_get_main_queue(), ^{ ok = stopScreenSelection(); });
|
|
890
|
+
return ok;
|
|
891
|
+
}
|
|
865
892
|
cleanupScreenSelector();
|
|
866
|
-
NSLog(@"🖥️ SCREEN SELECTION: Stopped");
|
|
867
893
|
return true;
|
|
868
894
|
|
|
869
895
|
} @catch (NSException *exception) {
|