Skip to content

Commit

Permalink
chore: remove unchanging param
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Jan 2, 2025
1 parent 295eb2b commit bc9f97f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/api-wrappers/CGWindowID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/logic/Windows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit bc9f97f

Please sign in to comment.