New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-4073] CGEventMask & CGEventMaskBit bridging situation is poor #46656
Comments
I'd be happy to implement this, but I imagine it's more appropriate to hand off to the CoreGraphics team internally... Who's the right person to ask about this? (@parkera?) |
Here's an example implementation (as a separate type, not replacing the CGEventMask typealias): struct CGEventSet: OptionSet {
let rawValue: CGEventMask
static let allEvents = ~CGEventMask.allZeros
static let leftMouseDown = CGEventSet(rawValue: UInt64(1 << CGEventType.leftMouseDown.rawValue))
static let leftMouseUp = CGEventSet(rawValue: UInt64(1 << CGEventType.leftMouseUp.rawValue))
static let rightMouseDown = CGEventSet(rawValue: UInt64(1 << CGEventType.rightMouseDown.rawValue))
static let rightMouseUp = CGEventSet(rawValue: UInt64(1 << CGEventType.rightMouseUp.rawValue))
static let mouseMoved = CGEventSet(rawValue: UInt64(1 << CGEventType.mouseMoved.rawValue))
static let leftMouseDragged = CGEventSet(rawValue: UInt64(1 << CGEventType.leftMouseDragged.rawValue))
static let rightMouseDragged = CGEventSet(rawValue: UInt64(1 << CGEventType.rightMouseDragged.rawValue))
static let keyDown = CGEventSet(rawValue: UInt64(1 << CGEventType.keyDown.rawValue))
static let keyUp = CGEventSet(rawValue: UInt64(1 << CGEventType.keyUp.rawValue))
static let flagsChanged = CGEventSet(rawValue: UInt64(1 << CGEventType.flagsChanged.rawValue))
static let scrollWheel = CGEventSet(rawValue: UInt64(1 << CGEventType.scrollWheel.rawValue))
static let tabletPointer = CGEventSet(rawValue: UInt64(1 << CGEventType.tabletPointer.rawValue))
static let tabletProximity = CGEventSet(rawValue: UInt64(1 << CGEventType.tabletProximity.rawValue))
static let otherMouseDown = CGEventSet(rawValue: UInt64(1 << CGEventType.otherMouseDown.rawValue))
static let otherMouseUp = CGEventSet(rawValue: UInt64(1 << CGEventType.otherMouseUp.rawValue))
static let otherMouseDragged = CGEventSet(rawValue: UInt64(1 << CGEventType.otherMouseDragged.rawValue))
static let tapDisabledByTimeout = CGEventSet(rawValue: UInt64(1 << CGEventType.tapDisabledByTimeout.rawValue))
static let tapDisabledByUserInput = CGEventSet(rawValue: UInt64(1 << CGEventType.tapDisabledByUserInput.rawValue))
} |
I'll make sure your radar gets sent to the right place. Thanks for filing it. |
(you're right that it should be the CG team which looks at this - each framework owner is responsible for their overlay) |
Thanks, I appreciate it. On a separate note, I also noticed all the CGEventTap APIs are bizarrely imported as |
Closing since CoreGraphics is not part of the Swift Open Source project. Thanks for filing the Radar! |
CG itself isn't part of the open source project, but the overlay is: https://github.com/apple/swift/blob/master/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift Does that still fall completely under the internal team's purview? |
The overlay is also not part of the open source project from a process perspective. Think of it as a build dependency. |
Additional Detail from JIRA
md5: b015d70c4497d7d58830c2d2327b6438
Issue Description:
CGEventMask
is imported as atypealias
. The macro#define CGEventMaskBit(eventType) ((CGEventMask)1 << (eventType))
is not imported at all.I think an optimal solution would import
CGEventMask
as anOptionSet
with members mirroring theCGEventType
members.The text was updated successfully, but these errors were encountered: