File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed
Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ struct CloseCommand: Command {
1111 return io. err ( " Empty workspace " )
1212 }
1313 // Access ax directly. Not cool :(
14- if try await args. quitIfLastWindow. andAsyncMainActor ( try await window. macAppUnsafe. getAxWindowsCount ( ) == 1 ) {
14+ if try await args. quitIfLastWindow. andAsyncMainActor ( { try await window. macAppUnsafe. getAxWindowsCount ( ) == 1 } ) {
1515 if window. macAppUnsafe. nsApp. terminate ( ) {
1616 window. asMacWindow ( ) . macApp. destroy ( skipClosedWindowsCache: true )
1717 return true
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ private func moveWithMouseIfTheCase(_ window: Window) async throws { // todo cov
1818 if try await ( window. isHiddenInCorner || // Don't allow to move windows of hidden workspaces
1919 !isLeftMouseButtonDown ||
2020 currentlyManipulatedWithMouseWindowId != nil && window. windowId != currentlyManipulatedWithMouseWindowId)
21- . orAsyncMainActor ( try await getNativeFocusedWindow ( ) != window)
21+ . orAsyncMainActor ( { try await getNativeFocusedWindow ( ) != window } )
2222 {
2323 return
2424 }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ private func resizeWithMouseIfTheCase(_ window: Window) async throws { // todo c
3131 if try await ( window. isHiddenInCorner || // Don't allow to resize windows of hidden workspaces
3232 !isLeftMouseButtonDown ||
3333 currentlyManipulatedWithMouseWindowId != nil && window. windowId != currentlyManipulatedWithMouseWindowId)
34- . orAsyncMainActor ( try await getNativeFocusedWindow ( ) != window)
34+ . orAsyncMainActor ( { try await getNativeFocusedWindow ( ) != window } )
3535 {
3636 return
3737 }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ private func validateStillPopups() async throws {
2323private func _normalizeLayoutReason( workspace: Workspace , windows: [ Window ] ) async throws {
2424 for window in windows {
2525 let isMacosFullscreen = try await window. isMacosFullscreen
26- let isMacosMinimized = try await ( !isMacosFullscreen) . andAsyncMainActor ( try await window. isMacosMinimized)
26+ let isMacosMinimized = try await ( !isMacosFullscreen) . andAsyncMainActor { try await window. isMacosMinimized }
2727 let isMacosWindowOfHiddenApp = !isMacosFullscreen && !isMacosMinimized &&
2828 !config. automaticallyUnhideMacosHiddenApps && window. macAppUnsafe. nsApp. isHidden
2929 switch window. layoutReason {
Original file line number Diff line number Diff line change 11import Foundation
22
3+ // todo convert rhs lambdas to @autoclosure when GH Actions migrates to Xcode 16.3
4+
35// https://forums.swift.org/t/using-async-call-in-boolean-expression/52943
46// https://github.com/swiftlang/swift/issues/56869
57// https://forums.swift.org/t/potential-false-positive-sending-risks-causing-data-races/78859
68public extension Bool {
79 @inlinable
8- func andAsync( isolation: isolated ( any Actor ) ? = #isolation, _ rhs: @autoclosure ( ) async throws -> Bool ) async rethrows -> Bool {
10+ func andAsync( isolation: isolated ( any Actor ) ? = #isolation, _ rhs: ( ) async throws -> Bool ) async rethrows -> Bool {
911 if self {
1012 return try await rhs ( )
1113 }
@@ -14,15 +16,15 @@ public extension Bool {
1416
1517 @inlinable
1618 @MainActor
17- func andAsyncMainActor( _ rhs: @MainActor @ autoclosure ( ) async throws -> Bool ) async rethrows -> Bool {
19+ func andAsyncMainActor( _ rhs: @MainActor ( ) async throws -> Bool ) async rethrows -> Bool {
1820 if self {
1921 return try await rhs ( )
2022 }
2123 return false
2224 }
2325
2426 @inlinable
25- func orAsync( isolation: isolated ( any Actor ) ? = #isolation, _ rhs: @autoclosure ( ) async throws -> Bool ) async rethrows -> Bool {
27+ func orAsync( isolation: isolated ( any Actor ) ? = #isolation, _ rhs: ( ) async throws -> Bool ) async rethrows -> Bool {
2628 if self {
2729 return true
2830 }
@@ -31,7 +33,7 @@ public extension Bool {
3133
3234 @inlinable
3335 @MainActor
34- func orAsyncMainActor( _ rhs: @MainActor @ autoclosure ( ) async throws -> Bool ) async rethrows -> Bool {
36+ func orAsyncMainActor( _ rhs: @MainActor ( ) async throws -> Bool ) async rethrows -> Bool {
3537 if self {
3638 return true
3739 }
You can’t perform that action at this time.
0 commit comments