Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions electron/native/ScreenCaptureKitRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,22 @@ final class ScreenCaptureRecorder: NSObject, SCStreamOutput, SCStreamDelegate {
throw NSError(domain: "RecordlyCapture", code: 3, userInfo: [NSLocalizedDescriptionKey: "Window not found"])
}

filter = SCContentFilter(desktopIndependentWindow: window)

let candidateDisplay = availableContent.displays.first(where: {
$0.frame.intersects(window.frame) || $0.frame.contains(CGPoint(x: window.frame.midX, y: window.frame.midY))
})
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
let scaleFactor = ScreenCaptureRecorder.scaleFactor(for: candidateDisplay?.displayID ?? CGMainDisplayID())
outputWidth = max(2, Int(window.frame.width) * scaleFactor)
outputHeight = max(2, Int(window.frame.height) * scaleFactor)
if #available(macOS 14.0, *) {
streamConfig.ignoreShadowsSingleWindow = true

if let candidateDisplay, let owningApplication = window.owningApplication {
filter = SCContentFilter(display: candidateDisplay, including: [owningApplication], exceptingWindows: [])
streamConfig.sourceRect = window.frame
} else {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
filter = SCContentFilter(desktopIndependentWindow: window)
enableChildWindowCaptureIfSupported(streamConfig: streamConfig)
if #available(macOS 14.0, *) {
streamConfig.ignoreShadowsSingleWindow = true
}
}
streamConfig.width = outputWidth
streamConfig.height = outputHeight
Expand Down Expand Up @@ -550,6 +556,12 @@ final class ScreenCaptureRecorder: NSObject, SCStreamOutput, SCStreamDelegate {
return supportsConfigSelector && supportsDeviceSelector && supportsOutputType
}

private func enableChildWindowCaptureIfSupported(streamConfig: SCStreamConfiguration) {
guard streamConfig.responds(to: Selector(("setIncludeChildWindows:"))) else { return }

streamConfig.setValue(true, forKey: "includeChildWindows")
}

private func startWindowValidationIfNeeded() {
guard let trackedWindowId else {
windowValidationTask?.cancel()
Expand Down Expand Up @@ -715,4 +727,3 @@ DispatchQueue.global(qos: .utility).async {
}

service.waitUntilFinished()

Binary file modified electron/native/bin/darwin-arm64/recordly-screencapturekit-helper
Binary file not shown.
Binary file modified electron/native/bin/darwin-x64/recordly-screencapturekit-helper
Binary file not shown.