From e435e5e768ebfb66beb483c5e9373ae54498182e Mon Sep 17 00:00:00 2001 From: Martin Persson Date: Tue, 10 Oct 2023 22:57:45 +0200 Subject: [PATCH] Use a correct scaling factor this amazing pointPixelScale discovery was brought to you by the equally amazing @saagarjha --- Azayaka.xcodeproj/project.pbxproj | 8 ++++---- Azayaka/Recording.swift | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Azayaka.xcodeproj/project.pbxproj b/Azayaka.xcodeproj/project.pbxproj index 3eeacfb..397077e 100644 --- a/Azayaka.xcodeproj/project.pbxproj +++ b/Azayaka.xcodeproj/project.pbxproj @@ -283,7 +283,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 35; + CURRENT_PROJECT_VERSION = 36; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 35BSP6SUG9; ENABLE_HARDENED_RUNTIME = YES; @@ -298,7 +298,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = "1.1.1-beta1"; + MARKETING_VERSION = "1.1.1-beta2"; PRODUCT_BUNDLE_IDENTIFIER = dev.mnpn.Azayaka; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -315,7 +315,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 35; + CURRENT_PROJECT_VERSION = 36; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 35BSP6SUG9; ENABLE_HARDENED_RUNTIME = YES; @@ -330,7 +330,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = "1.1.1-beta1"; + MARKETING_VERSION = "1.1.1-beta2"; PRODUCT_BUNDLE_IDENTIFIER = dev.mnpn.Azayaka; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/Azayaka/Recording.swift b/Azayaka/Recording.swift index 7eb9162..44b02cc 100644 --- a/Azayaka/Recording.swift +++ b/Azayaka/Recording.swift @@ -49,10 +49,8 @@ extension AppDelegate { conf.height = 2 if !audioOnly { - let scale: Int = Int((screen != nil ? NSScreen.screens.first(where: { $0.displayID == screen?.displayID })!.backingScaleFactor : NSScreen.main?.backingScaleFactor) ?? 1) - // todo: find relevant scaling factor. it seems windows are available on all displays though, and there's no way to get a window's display, so this is tricky - conf.width = streamType == .screen ? availableContent!.displays[0].width*scale : Int((window?.frame.width)!*CGFloat(scale)) - conf.height = streamType == .screen ? availableContent!.displays[0].height*scale : Int((window?.frame.height)!*CGFloat(scale)) + conf.width = Int(filter.contentRect.width) * Int(filter.pointPixelScale) + conf.height = Int(filter.contentRect.height) * Int(filter.pointPixelScale) } conf.minimumFrameInterval = CMTime(value: 1, timescale: audioOnly ? CMTimeScale.max : CMTimeScale(ud.integer(forKey: "frameRate")))