NSEventImpl // Add KeyCode.toEvent().
This commit is contained in:
parent
1fabd619e0
commit
2bfb29aea4
|
@ -250,6 +250,15 @@ public enum KeyCode: UInt16 {
|
||||||
case kRightArrow = 124
|
case kRightArrow = 124
|
||||||
case kDownArrow = 125
|
case kDownArrow = 125
|
||||||
case kUpArrow = 126
|
case kUpArrow = 126
|
||||||
|
|
||||||
|
public func toEvent() -> NSEvent? {
|
||||||
|
NSEvent.keyEvent(
|
||||||
|
with: .keyDown, location: .zero, modifierFlags: [],
|
||||||
|
timestamp: TimeInterval(), windowNumber: 0, context: nil,
|
||||||
|
characters: "", charactersIgnoringModifiers: "",
|
||||||
|
isARepeat: false, keyCode: rawValue
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum KeyCodeBlackListed: UInt16 {
|
enum KeyCodeBlackListed: UInt16 {
|
||||||
|
|
Loading…
Reference in New Issue