Skip to content

Commit

Permalink
fix: don't require receivers to be active to satisfy dispatchingPrere…
Browse files Browse the repository at this point in the history
…quisites
  • Loading branch information
Akazm committed Dec 16, 2024
1 parent 7b78297 commit 6493867
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/TapGuard/HIDEventDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public final class HIDEventDispatcher: Sendable {
public var dispatchingPrerequisites: HIDEventDispatcherEnabledPrerequisite {
systemPrerequisites.withLock { $0 }
.union(isEnabled() ? [.enabled] : [])
.union(!getActiveReceivers().isEmpty ? [.hasReceivers] : [])
.union(!getReceivers().isEmpty ? [.hasReceivers] : [])
.union(suspensions.withLock { $0 }.isEmpty ? [.allSuspensionsReleased] : [])
}

Expand Down Expand Up @@ -238,8 +238,12 @@ public final class HIDEventDispatcher: Sendable {
return Unmanaged.passUnretained(event)
}

func getActiveReceivers() -> [AnyHIDEventReceiver] {
func getReceivers() -> [AnyHIDEventReceiver] {
receivers.withLock { $0 }
}

func getActiveReceivers() -> [AnyHIDEventReceiver] {
getReceivers()
.filter(\.hidEventReceiverEnabled)
.sorted { $0.hidEventReceiverPriority < $1.hidEventReceiverPriority }
}
Expand Down

0 comments on commit 6493867

Please sign in to comment.