From bc9f97f8528044ea0e40efd074a3ee4d801f2513 Mon Sep 17 00:00:00 2001 From: lwouis Date: Thu, 2 Jan 2025 18:33:15 +0100 Subject: [PATCH] chore: remove unchanging param --- src/api-wrappers/CGWindowID.swift | 4 ++-- src/logic/Windows.swift | 8 ++++---- src/ui/App.swift | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api-wrappers/CGWindowID.swift b/src/api-wrappers/CGWindowID.swift index 6aa7f3c0..56a49c09 100644 --- a/src/api-wrappers/CGWindowID.swift +++ b/src/api-wrappers/CGWindowID.swift @@ -15,10 +15,10 @@ extension CGWindowID { return CGSCopySpacesForWindows(cgsMainConnectionId, CGSSpaceMask.all.rawValue, [self] as CFArray) as! [CGSSpaceID] } - func screenshot(_ bestResolution: Bool) -> CGImage? { + func screenshot() -> CGImage? { // CGSHWCaptureWindowList var windowId_ = self - let list = CGSHWCaptureWindowList(cgsMainConnectionId, &windowId_, 1, [.ignoreGlobalClipShape, bestResolution ? .bestResolution : .nominalResolution]).takeRetainedValue() as! [CGImage] + let list = CGSHWCaptureWindowList(cgsMainConnectionId, &windowId_, 1, [.ignoreGlobalClipShape, .bestResolution]).takeRetainedValue() as! [CGImage] return list.first // // CGWindowListCreateImage diff --git a/src/logic/Windows.swift b/src/logic/Windows.swift index e30e4ebb..cdce3e1d 100644 --- a/src/logic/Windows.swift +++ b/src/logic/Windows.swift @@ -298,7 +298,7 @@ class Windows { } // dispatch screenshot requests off the main-thread, then wait for completion - static func refreshThumbnails(_ windows: [Window], _ bestResolution: Bool, _ onlyUpdateScreenshots: Bool) { + static func refreshThumbnails(_ windows: [Window], _ onlyUpdateScreenshots: Bool) { if Appearance.hideThumbnails { return } var eligibleWindows = [Window]() for window in windows { @@ -307,10 +307,10 @@ class Windows { } } if eligibleWindows.isEmpty { return } - screenshotEligibleWindowsAndRefreshUi(eligibleWindows, bestResolution, onlyUpdateScreenshots) + screenshotEligibleWindowsAndRefreshUi(eligibleWindows, onlyUpdateScreenshots) } - private static func screenshotEligibleWindowsAndRefreshUi(_ eligibleWindows: [Window], _ bestResolution: Bool, _ onlyUpdateScreenshots: Bool) { + private static func screenshotEligibleWindowsAndRefreshUi(_ eligibleWindows: [Window], _ onlyUpdateScreenshots: Bool) { eligibleWindows.forEach { _ in BackgroundWork.screenshotsDispatchGroup.enter() } for window in eligibleWindows { BackgroundWork.screenshotsQueue.async { [weak window] in @@ -319,7 +319,7 @@ class Windows { backgroundWorkGlobalSemaphore.signal() BackgroundWork.screenshotsDispatchGroup.leave() } - if let cgImage = window?.cgWindowId?.screenshot(bestResolution) { + if let cgImage = window?.cgWindowId?.screenshot() { DispatchQueue.main.async { [weak window] in window?.refreshThumbnail(NSImage.fromCgImage(cgImage)) } diff --git a/src/ui/App.swift b/src/ui/App.swift index 79095d2a..0f6793e7 100644 --- a/src/ui/App.swift +++ b/src/ui/App.swift @@ -251,7 +251,7 @@ class App: AppCenterApplication, NSApplicationDelegate { func refreshOpenUi(_ windowsToScreenshot: [Window], skipUpdatesBeforeShowing: Bool = false, onlyUpdateScreenshots: Bool = false) { if !Appearance.hideThumbnails && !windowsToScreenshot.isEmpty { - Windows.refreshThumbnails(windowsToScreenshot, true, onlyUpdateScreenshots) + Windows.refreshThumbnails(windowsToScreenshot, onlyUpdateScreenshots) return } guard appIsBeingUsed else { return }