scoop:scoop.window:0.1.0
src/input/keyboard.scoop
Selected production source · src/input/keyboard.scoop
1
package scoop.window3
/** State shared by physical keys and pointer buttons. */4
public enum ElementState {5
Pressed, Released6
}8
/** A key's physical region, independent of the active text layout. */9
public enum KeyLocation {10
Standard, Left, Right, Numpad11
}13
/** An unrecognized key retains its platform encoding. */14
public enum NativeKeyCode {15
Darwin(UInt), UsbHidUsage(UInt), WindowsScanCode(UInt), WindowsVirtualKey(UInt), LinuxEvdev(16
UInt17
), XkbKeysym(UInt)18
}20
/** Layout-independent keyboard positions supported by the current backend. */21
public enum KeyCode {22
KeyA, KeyB, KeyC, KeyD, KeyE, KeyF, KeyG, KeyH, KeyI, KeyJ, KeyK, KeyL, KeyM,23
KeyN, KeyO, KeyP, KeyQ, KeyR, KeyS, KeyT, KeyU, KeyV, KeyW, KeyX, KeyY, KeyZ,24
Digit0, Digit1, Digit2, Digit3, Digit4, Digit5, Digit6, Digit7, Digit8, Digit9,25
Backquote, Backslash, BracketLeft, BracketRight, Comma, Equal, Minus, Period, Quote,26
Semicolon, Slash, IntlBackslash, IntlYen, IntlRo, Lang1, Lang2,27
Enter, Tab, Space, Backspace, Escape, CapsLock, NumLock, ScrollLock, Insert, PrintScreen, Pause, Fn,28
SuperLeft, SuperRight, ShiftLeft, ShiftRight, ControlLeft, ControlRight, AltLeft, AltRight,29
ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Delete, Home, End, PageUp, PageDown, Help, ContextMenu,30
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20,31
AudioVolumeUp, AudioVolumeDown, AudioVolumeMute,32
Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9,33
NumpadAdd, NumpadSubtract, NumpadMultiply, NumpadDivide, NumpadDecimal, NumpadEqual,34
NumpadEnter, NumpadClear, NumpadComma35
}37
/** Known physical keys and explicit native fallbacks. */38
public enum PhysicalKey {39
Code(KeyCode), Unidentified(NativeKeyCode)40
}42
/** Non-text logical keys, including layout-independent editing commands. */43
public enum NamedKey {44
Enter, Tab, Space, Backspace, Escape, Shift, Control, Alt, Super, CapsLock, NumLock, ScrollLock, Insert, PrintScreen, Pause, Fn,45
ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Delete, Home, End, PageUp, PageDown, Help, ContextMenu,46
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20,47
Clear, AudioVolumeUp, AudioVolumeDown, AudioVolumeMute, Eisu, Kana48
}50
/** Logical keys describe shortcuts; text insertion uses TextInputEvent exclusively. */51
public enum LogicalKey {52
Named(NamedKey), Character(String), Dead(String?), Unidentified(NativeKeyCode)53
}55
/** None means that the native event did not identify the modifier's side. */56
public struct ModifierSides(val left: Boolean?, val right: Boolean?)58
/** Modifier state at the same native event; unsupported lock states remain unknown. */59
public struct Modifiers(60
val shift: Boolean,61
val control: Boolean,62
val alt: Boolean,63
val superKey: Boolean,64
val capsLock: Boolean,65
val function: Boolean,66
val shiftSides: ModifierSides,67
val controlSides: ModifierSides,68
val altSides: ModifierSides,69
val superSides: ModifierSides,70
val numLock: Boolean? = None,71
val scrollLock: Boolean? = None,72
val altGraph: Boolean? = None73
)75
/** An owned key notification; synthetic releases have no invented hardware time. */76
public struct KeyEvent(77
val physicalKey: PhysicalKey,78
val logicalKey: LogicalKey,79
val location: KeyLocation,80
val state: ElementState,81
val isRepeat: Boolean,82
val modifiers: Modifiers,83
val synthetic: Boolean,84
val time: InputTime,85
val deviceId: DeviceId? = None,86
val textCommands: Array<TextEditCommand> = []87
)