1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
//! Helper enum to define scan codes on the QWERTY keyboard layout.

/// The key locations as defined by the keys on the QWERTY keyboard layout.
///
/// The [`u32`] representation of this enum are scan codes of the corresponding keys on X-like Linux systems.
/// See <https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h>.
#[repr(u32)]
pub enum QwertyScanCode {
    /// The location of the Escape/Esc key on the QWERTY keyboard layout.
    Escape = 1,
    /// The location of the `1` key on the QWERTY keyboard layout.
    Key1 = 2,
    /// The location of the `2` key on the QWERTY keyboard layout.
    Key2 = 3,
    /// The location of the `3` key on the QWERTY keyboard layout.
    Key3 = 4,
    /// The location of the `4` key on the QWERTY keyboard layout.
    Key4 = 5,
    /// The location of the `5` key on the QWERTY keyboard layout.
    Key5 = 6,
    /// The location of the `6` key on the QWERTY keyboard layout.
    Key6 = 7,
    /// The location of the `7` key on the QWERTY keyboard layout.
    Key7 = 8,
    /// The location of the `8` key on the QWERTY keyboard layout.
    Key8 = 9,
    /// The location of the `9` key on the QWERTY keyboard layout.
    Key9 = 10,
    /// The location of the `0` key on the QWERTY keyboard layout.
    Key0 = 11,
    /// The location of the `-` key on the QWERTY keyboard layout.
    Minus = 12,
    /// The location of the `=` key on the QWERTY keyboard layout.
    Equals = 13,
    /// The location of the back(space) key on the QWERTY keyboard layout.
    Backspace = 14,
    /// The location of the tabulator key on the QWERTY keyboard layout.
    Tab = 15,
    /// The location of the `Q`  key on the QWERTY keyboard layout.
    Q = 16,
    /// The location of the `W`  key on the QWERTY keyboard layout.
    W = 17,
    /// The location of the `E`  key on the QWERTY keyboard layout.
    E = 18,
    /// The location of the `R`  key on the QWERTY keyboard layout.
    R = 19,
    /// The location of the `T`  key on the QWERTY keyboard layout.
    T = 20,
    /// The location of the `Y`  key on the QWERTY keyboard layout.
    Y = 21,
    /// The location of the `U`  key on the QWERTY keyboard layout.
    U = 22,
    /// The location of the `I`  key on the QWERTY keyboard layout.
    I = 23,
    /// The location of the `O`  key on the QWERTY keyboard layout.
    O = 24,
    /// The location of the `P`  key on the QWERTY keyboard layout.
    P = 25,
    /// The location of the `[`  key on the QWERTY keyboard layout.
    BracketLeft = 26,
    /// The location of the `]`  key on the QWERTY keyboard layout.
    BracketRight = 27,
    /// The location of the Enter/Return key on the QWERTY keyboard layout.
    Enter = 28,
    /// The location of the left Control key on the QWERTY keyboard layout.
    ControlLeft = 29,
    /// The location of the `A`  key on the QWERTY keyboard layout.
    A = 30,
    /// The location of the `S`  key on the QWERTY keyboard layout.
    S = 31,
    /// The location of the `D`  key on the QWERTY keyboard layout.
    D = 32,
    /// The location of the `F`  key on the QWERTY keyboard layout.
    F = 33,
    /// The location of the `G`  key on the QWERTY keyboard layout.
    G = 34,
    /// The location of the `H`  key on the QWERTY keyboard layout.
    H = 35,
    /// The location of the `J`  key on the QWERTY keyboard layout.
    J = 36,
    /// The location of the `K`  key on the QWERTY keyboard layout.
    K = 37,
    /// The location of the `L`  key on the QWERTY keyboard layout.
    L = 38,
    /// The location of the `;`  key on the QWERTY keyboard layout.
    SemiColon = 39,
    /// The location of the `'`  key on the QWERTY keyboard layout.
    Apostrophe = 40,
    /// The location of the `` ` `` key on the QWERTY keyboard layout.
    Backtick = 41,
    /// The location of the left Shift key on the QWERTY keyboard layout.
    ShiftLeft = 42,
    /// The location of the `\` on the QWERTY keyboard layout.
    Backslash = 43,
    /// The location of the `Z` key on the QWERTY keyboard layout.
    Z = 44,
    /// The location of the `X` key on the QWERTY keyboard layout.
    X = 45,
    /// The location of the `C` key on the QWERTY keyboard layout.
    C = 46,
    /// The location of the `V key on the QWERTY keyboard layout.
    V = 47,
    /// The location of the `B` key on the QWERTY keyboard layout.
    B = 48,
    /// The location of the `N` key on the QWERTY keyboard layout.
    N = 49,
    /// The location of the `M` key on the QWERTY keyboard layout.
    M = 50,
    /// The location of the `,` key on the QWERTY keyboard layout.
    Comma = 51,
    /// The location of the `.` key on the QWERTY keyboard layout.
    Period = 52,
    /// The location of the `/` key on the QWERTY keyboard layout.
    Slash = 53,
    /// The location of the right Shift key on the QWERTY keyboard layout.
    ShiftRight = 54,
    /// The location of the `*` key on the numpad of the QWERTY keyboard layout.
    /// Maps to `NumpadDivide` on Apple keyboards.
    NumpadMultiply = 55,
    /// The location of the left Alt  key on the QWERTY keyboard layout.
    /// Maps to left Option key on Apple keyboards.
    AltLeft = 56,
    /// The location of the Space key on the QWERTY keyboard layout.
    Space = 57,
    /// The location of the caps lock  key on the QWERTY keyboard layout.
    CapsLock = 58,
    /// The location of the `F1` key on the QWERTY keyboard layout.
    F1 = 59,
    /// The location of the `F2` key on the QWERTY keyboard layout.
    F2 = 60,
    /// The location of the `F3` key on the QWERTY keyboard layout.
    F3 = 61,
    /// The location of the `F4` key on the QWERTY keyboard layout.
    F4 = 62,
    /// The location of the `F5` key on the QWERTY keyboard layout.
    F5 = 63,
    /// The location of the `F6` key on the QWERTY keyboard layout.
    F6 = 64,
    /// The location of the `F7` key on the QWERTY keyboard layout.
    F7 = 65,
    /// The location of the `F8` key on the QWERTY keyboard layout.
    F8 = 66,
    /// The location of the `F9` key on the QWERTY keyboard layout.
    F9 = 67,
    /// The location of the `F10` key on the QWERTY keyboard layout.
    F10 = 68,
    /// The location of the Numlock key on the QWERTY keyboard layout.
    /// Maps to `NumpadClear` on Apple keyboards.
    Numlock = 69,
    /// The location of the Scroll / Scroll Lock key on the QWERTY keyboard layout.
    /// Maps to the `F14` key on Apple keyboards.
    Scroll = 70,
    /// The location of the `7` key on the numpad of the QWERTY keyboard layout.
    Numpad7 = 71,
    /// The location of the `8` key on the numpad of the QWERTY keyboard layout.
    Numpad8 = 72,
    /// The location of the `9` key on the numpad of the QWERTY keyboard layout.
    Numpad9 = 73,
    /// The location of the `*` key on the numpad of the QWERTY keyboard layout.
    /// Maps to `NumpadMultiply` on Apple keyboards.
    NumpadSubtract = 74,
    /// The location of the `4` key on the numpad of the QWERTY keyboard layout.
    Numpad4 = 75,
    /// The location of the `5` key on the numpad of the QWERTY keyboard layout.
    Numpad5 = 76,
    /// The location of the `6` key on the numpad of the QWERTY keyboard layout.
    Numpad6 = 77,
    /// The location of the `+` key on the numpad of the QWERTY keyboard layout.
    NumpadAdd = 78,
    /// The location of the `1` key on the numpad of the QWERTY keyboard layout.
    Numpad1 = 79,
    /// The location of the `2` key on the numpad of the QWERTY keyboard layout.
    Numpad2 = 80,
    /// The location of the `3` key on the numpad of the QWERTY keyboard layout.
    Numpad3 = 81,
    /// The location of the `0` key on the numpad of the QWERTY keyboard layout.
    Numpad0 = 82,
    /// The location of the `.` key on the numpad of the QWERTY keyboard layout.
    NumpadDecimal = 83,
    // KEY_ZENKAKUHANKAKU = 85,
    // KEY_102ND = 86,
    /// The location of the `F11` key on the QWERTY keyboard layout.
    F11 = 87,
    /// The location of the `F12` key on the QWERTY keyboard layout.
    F12 = 88,
    // KEY_R0 = 89,
    // KEY_KATAKANA = 90,
    // KEY_HIRAGANA = 91,
    // KEY_HENKAN = 92,
    // KEY_KATAKANAHIRAGANA = 93,
    // KEY_MUHENKAN = 94,
    // KEY_KPJPCOMMA = 95,
    /// The location of the Enter key on the numpad of the QWERTY keyboard layout.
    NumpadEnter = 96,
    /// The location of the right Control key on the QWERTY keyboard layout.
    ControlRight = 97,
    /// The location of the `/` key on the numpad of the QWERTY keyboard layout.
    /// Maps to `NumpadEquals` on Apple keyboards.
    NumpadDivide = 98,
    /// The location of the Alt+Sysrq key on the QWERTY keyboard layout.
    AltSysrq = 99,
    /// The location of the right Alt key on the QWERTY keyboard layout.
    /// Maps to right Option key on Apple keyboards.
    AltRight = 100,
    // KEY_LINEFEED = 101,
    /// The location of the Home key on the QWERTY keyboard layout.
    Home = 102,
    /// The location of the Arrow Up key on the QWERTY keyboard layout.
    Up = 103,
    /// The location of the Page Up key on the QWERTY keyboard layout.
    PageUp = 104,
    /// The location of the Arrow Left key on the QWERTY keyboard layout.
    Left = 105,
    /// The location of the Arrow Right key on the QWERTY keyboard layout.
    Right = 106,
    /// The location of the End key on the QWERTY keyboard layout.
    End = 107,
    /// The location of the Arrow Down key on the QWERTY keyboard layout.
    Down = 108,
    /// The location of the Page Down key on the QWERTY keyboard layout.
    PageDown = 109,
    /// The location of the Insert key on the QWERTY keyboard layout.
    /// Maps to the Help key on Apple keyboards.
    Insert = 110,
    /// The location of the Delete key on the QWERTY keyboard layout.
    Delete = 111,
    // KEY_MACRO = 112,
    // KEY_MUTE = 113,
    // KEY_VOLUMEDOWN = 114,
    // KEY_VOLUMEDOWN = 115,
    /// The location of the Power key on the QWERTY keyboard layout.
    Power = 116,
    // KEY_KPEQUAL = 117,
    // KEY_KPPLUSMINUS = 118,
    /// The location of the Pause key on the QWERTY keyboard layout.
    /// Maps to the `F15` key on Apple keyboards.
    Pause = 119,
    // KEY_SCALE = 120,
    // KEY_KPCOMMA = 121,
    // KEY_HANGEUL = 122,
    // KEY_HANJA = 123,
    // KEY_YEN = 124,
    /// The location of the left Windows key on the QWERTY keyboard layout.
    /// Maps to the Command key on Apple keyboards.
    SuperLeft = 125,
    /// The location of the right Windows key on the QWERTY keyboard layout.
    SuperRight = 126,
    // KEY_COMPOSE = 127,
    // KEY_STOP = 128,
    // KEY_AGAIN = 129,
    // KEY_PROPS = 130,
    // KEY_UNDO = 131,
    // KEY_FRONT = 132,
    // KEY_COPY = 133,
    // KEY_OPEN = 134,
    // KEY_PASTE = 135,
    // KEY_FIND = 136,
    // KEY_CUT = 137,
    // KEY_HELP = 138,
    /// The location of the Menu key on the QWERTY keyboard layout.
    Menu = 139,
    // KEY_CALC = 140,
    // KEY_SETUP = 141,
    /// The location of the Sleep key on the QWERTY keyboard layout.
    Sleep = 142,
    /// The location of the Wake key on the QWERTY keyboard layout.
    Wake = 143,
    // Keys to figure out later:
    // /// A key not available on the US QWERTY layout.
    // ///
    // /// This is for example the `#` key on other layouts.
    // NonUs1 = 0x00,
    // /// The location of the Snapshot / Print Screen key on the QWERTY keyboard layout.
    // /// Maps to the `F13` key on Apple keyboards.
    // Snapshot = 0xe0_37,
    // /// The location of the Ctrl+Break key on the QWERTY keyboard layout.
    // CtrlBreak = 0xe0_46,
}