From 3fdc2fca95793e1f95a06e27b139caa733f288e9 Mon Sep 17 00:00:00 2001 From: TZGyn Date: Wed, 12 Aug 2026 16:51:18 +0800 Subject: [PATCH] Fix vertical offset when capturing the secondary display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first ScreenCaptureKit Y-flip used the wrong reference edges, shifting cropped selections on displays below the main screen. Convert each selection per-display as scY = appKitY - NSScreen.maxY + SCDisplay.maxY, which matches both the main and secondary displays. 💘 Generated with Crush Assisted-by: Crush:deepseek-v4-flash-0731 --- Sources/Kapture/CaptureController.swift | 8 ++++---- build-app.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Kapture/CaptureController.swift b/Sources/Kapture/CaptureController.swift index a39ef1c..a12fffd 100644 --- a/Sources/Kapture/CaptureController.swift +++ b/Sources/Kapture/CaptureController.swift @@ -180,12 +180,12 @@ final class ScreenCapture { config.height = Int(CGFloat(display.height) * backingScale) config.showsCursor = true - // ScreenCaptureKit's Y axis is flipped relative to AppKit - // NSScreen frames. Convert the selection into SCDisplay space - // using the matching NSScreen's top edge, then crop there. + // ScreenCaptureKit uses a different origin than AppKit for + // screens stacked around the main display: per-display, + // SCDisplay y = appKitY - NSScreen.maxY + SCDisplay.maxY. let scRect = CGRect( x: rect.minX, - y: screen.frame.maxY - rect.maxY + display.frame.minY, + y: rect.minY - screen.frame.maxY + display.frame.maxY, width: rect.width, height: rect.height ) diff --git a/build-app.sh b/build-app.sh index 984c3b2..ba1a3fb 100755 --- a/build-app.sh +++ b/build-app.sh @@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST' CFBundleIconFile Icon CFBundleShortVersionString - 1.1.7 + 1.1.8 CFBundleVersion - 17 + 18 LSUIElement NSHighResolutionCapable