Skip to content

Commit

Permalink
fix: app crash from v7.13.0 (closes #4016)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Dec 24, 2024
1 parent 4481d94 commit d3b5bef
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/logic/Windows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,15 @@ class Windows {
for (index, cgWindowId) in Spaces.windowsInSpaces(Spaces.visibleSpaces).enumerated() {
windowLevelMap[cgWindowId] = index
}
var orderForUnlistedWindows = Int.max
for window in list {
if let listedOrder = windowLevelMap[window.cgWindowId] {
window.lastFocusOrder = listedOrder
} else {
window.lastFocusOrder = orderForUnlistedWindows
orderForUnlistedWindows -= 1
}
}
list.sort { $0.lastFocusOrder < $1.lastFocusOrder }
list = list
.sorted { w1, w2 in
(windowLevelMap[w1.cgWindowId] ?? .max) < (windowLevelMap[w2.cgWindowId] ?? .max)
}
.enumerated()
.map { (index, window) -> Window in
window.lastFocusOrder = index
return window
}
}

static func refreshThumbnailsAsync(_ screen: NSScreen, _ currentIndex: Int) {
Expand Down

0 comments on commit d3b5bef

Please sign in to comment.