Skip to content

Commit

Permalink
refactor: simplify event mask
Browse files Browse the repository at this point in the history
  • Loading branch information
ShlomoCode committed Jul 27, 2024
1 parent 577dbcc commit c5a481b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions DockDoor/logic/DockObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ final class DockObserver {
return Unmanaged.passUnretained(event)
}

let eventsOfInterest: CGEventMask = (1 << CGEventType.mouseMoved.rawValue) |
(1 << CGEventType.rightMouseDown.rawValue) |
(1 << CGEventType.leftMouseDown.rawValue) |
(1 << CGEventType.otherMouseDown.rawValue)
let eventTypes: [CGEventType] = [.mouseMoved, .rightMouseDown, .leftMouseDown, .otherMouseDown, .leftMouseUp]
let eventsOfInterest: CGEventMask = eventTypes
.reduce(CGEventMask(0)) { $0 | (1 << $1.rawValue) }

eventTap = CGEvent.tapCreate(
tap: .cghidEventTap,
Expand Down

0 comments on commit c5a481b

Please sign in to comment.