fix: address follow-up capture review

This commit is contained in:
young
2026-08-24 13:19:17 +10:00
parent 54c506dac7
commit e7fcb15cea
7 changed files with 22 additions and 7 deletions
@@ -428,9 +428,15 @@ func mouseInteractionCallback(
action = "mouseup"
button = 2
case .otherMouseDown:
guard event.getIntegerValueField(.mouseEventButtonNumber) == 2 else {
return Unmanaged.passUnretained(event)
}
action = "mousedown"
button = 3
case .otherMouseUp:
guard event.getIntegerValueField(.mouseEventButtonNumber) == 2 else {
return Unmanaged.passUnretained(event)
}
action = "mouseup"
button = 3
default:
+15 -7
View File
@@ -653,19 +653,27 @@ final class ScreenCaptureRecorder: NSObject, SCStreamOutput, SCStreamDelegate {
if Task.isCancelled { return }
guard self.isRecording else { return }
let availableContent: SCShareableContent
do {
let availableContent = try await SCShareableContent.excludingDesktopWindows(false, onScreenWindowsOnly: true)
let windowStillAvailable = availableContent.windows.contains(where: { $0.windowID == trackedWindowId })
if !windowStillAvailable {
print("WINDOW_UNAVAILABLE")
fflush(stdout)
availableContent = try await SCShareableContent.excludingDesktopWindows(false, onScreenWindowsOnly: true)
} catch {
continue
}
let windowStillAvailable = availableContent.windows.contains(where: { $0.windowID == trackedWindowId })
if !windowStillAvailable {
print("WINDOW_UNAVAILABLE")
fflush(stdout)
do {
let outputPath = try await self.finishCapture()
print("Recording stopped. Output path: \(outputPath)")
fflush(stdout)
exit(0)
} catch {
fputs("Error stopping capture: \(error.localizedDescription)\n", stderr)
fflush(stderr)
exit(1)
}
} catch {
continue
}
}
}
+1
View File
@@ -903,6 +903,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
webcamStopPromise.current = null;
pendingWebcamPathPromise.current = null;
resolvedWebcamPath.current = result ?? null;
webcamRecorder.current = null;
return result ?? null;
}, []);