1 | /* |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org> |
4 | |
5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
8 | |
9 | Permission is granted to anyone to use this software for any purpose, |
10 | including commercial applications, and to alter it and redistribute it |
11 | freely, subject to the following restrictions: |
12 | |
13 | 1. The origin of this software must not be misrepresented; you must not |
14 | claim that you wrote the original software. If you use this software |
15 | in a product, an acknowledgment in the product documentation would be |
16 | appreciated but is not required. |
17 | 2. Altered source versions must be plainly marked as such, and must not be |
18 | misrepresented as being the original software. |
19 | 3. This notice may not be removed or altered from any source distribution. |
20 | */ |
21 | #include "../../include/SDL_scancode.h" |
22 | |
23 | /* Linux virtual key code to SDL_Keycode mapping table |
24 | Sources: |
25 | - Linux kernel source input.h |
26 | */ |
27 | /* *INDENT-OFF* */ |
28 | static SDL_Scancode const linux_scancode_table[] = { |
29 | /* 0 */ SDL_SCANCODE_UNKNOWN, |
30 | /* 1 */ SDL_SCANCODE_ESCAPE, |
31 | /* 2 */ SDL_SCANCODE_1, |
32 | /* 3 */ SDL_SCANCODE_2, |
33 | /* 4 */ SDL_SCANCODE_3, |
34 | /* 5 */ SDL_SCANCODE_4, |
35 | /* 6 */ SDL_SCANCODE_5, |
36 | /* 7 */ SDL_SCANCODE_6, |
37 | /* 8 */ SDL_SCANCODE_7, |
38 | /* 9 */ SDL_SCANCODE_8, |
39 | /* 10 */ SDL_SCANCODE_9, |
40 | /* 11 */ SDL_SCANCODE_0, |
41 | /* 12 */ SDL_SCANCODE_MINUS, |
42 | /* 13 */ SDL_SCANCODE_EQUALS, |
43 | /* 14 */ SDL_SCANCODE_BACKSPACE, |
44 | /* 15 */ SDL_SCANCODE_TAB, |
45 | /* 16 */ SDL_SCANCODE_Q, |
46 | /* 17 */ SDL_SCANCODE_W, |
47 | /* 18 */ SDL_SCANCODE_E, |
48 | /* 19 */ SDL_SCANCODE_R, |
49 | /* 20 */ SDL_SCANCODE_T, |
50 | /* 21 */ SDL_SCANCODE_Y, |
51 | /* 22 */ SDL_SCANCODE_U, |
52 | /* 23 */ SDL_SCANCODE_I, |
53 | /* 24 */ SDL_SCANCODE_O, |
54 | /* 25 */ SDL_SCANCODE_P, |
55 | /* 26 */ SDL_SCANCODE_LEFTBRACKET, |
56 | /* 27 */ SDL_SCANCODE_RIGHTBRACKET, |
57 | /* 28 */ SDL_SCANCODE_RETURN, |
58 | /* 29 */ SDL_SCANCODE_LCTRL, |
59 | /* 30 */ SDL_SCANCODE_A, |
60 | /* 31 */ SDL_SCANCODE_S, |
61 | /* 32 */ SDL_SCANCODE_D, |
62 | /* 33 */ SDL_SCANCODE_F, |
63 | /* 34 */ SDL_SCANCODE_G, |
64 | /* 35 */ SDL_SCANCODE_H, |
65 | /* 36 */ SDL_SCANCODE_J, |
66 | /* 37 */ SDL_SCANCODE_K, |
67 | /* 38 */ SDL_SCANCODE_L, |
68 | /* 39 */ SDL_SCANCODE_SEMICOLON, |
69 | /* 40 */ SDL_SCANCODE_APOSTROPHE, |
70 | /* 41 */ SDL_SCANCODE_GRAVE, |
71 | /* 42 */ SDL_SCANCODE_LSHIFT, |
72 | /* 43 */ SDL_SCANCODE_BACKSLASH, |
73 | /* 44 */ SDL_SCANCODE_Z, |
74 | /* 45 */ SDL_SCANCODE_X, |
75 | /* 46 */ SDL_SCANCODE_C, |
76 | /* 47 */ SDL_SCANCODE_V, |
77 | /* 48 */ SDL_SCANCODE_B, |
78 | /* 49 */ SDL_SCANCODE_N, |
79 | /* 50 */ SDL_SCANCODE_M, |
80 | /* 51 */ SDL_SCANCODE_COMMA, |
81 | /* 52 */ SDL_SCANCODE_PERIOD, |
82 | /* 53 */ SDL_SCANCODE_SLASH, |
83 | /* 54 */ SDL_SCANCODE_RSHIFT, |
84 | /* 55 */ SDL_SCANCODE_KP_MULTIPLY, |
85 | /* 56 */ SDL_SCANCODE_LALT, |
86 | /* 57 */ SDL_SCANCODE_SPACE, |
87 | /* 58 */ SDL_SCANCODE_CAPSLOCK, |
88 | /* 59 */ SDL_SCANCODE_F1, |
89 | /* 60 */ SDL_SCANCODE_F2, |
90 | /* 61 */ SDL_SCANCODE_F3, |
91 | /* 62 */ SDL_SCANCODE_F4, |
92 | /* 63 */ SDL_SCANCODE_F5, |
93 | /* 64 */ SDL_SCANCODE_F6, |
94 | /* 65 */ SDL_SCANCODE_F7, |
95 | /* 66 */ SDL_SCANCODE_F8, |
96 | /* 67 */ SDL_SCANCODE_F9, |
97 | /* 68 */ SDL_SCANCODE_F10, |
98 | /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, |
99 | /* 70 */ SDL_SCANCODE_SCROLLLOCK, |
100 | /* 71 */ SDL_SCANCODE_KP_7, |
101 | /* 72 */ SDL_SCANCODE_KP_8, |
102 | /* 73 */ SDL_SCANCODE_KP_9, |
103 | /* 74 */ SDL_SCANCODE_KP_MINUS, |
104 | /* 75 */ SDL_SCANCODE_KP_4, |
105 | /* 76 */ SDL_SCANCODE_KP_5, |
106 | /* 77 */ SDL_SCANCODE_KP_6, |
107 | /* 78 */ SDL_SCANCODE_KP_PLUS, |
108 | /* 79 */ SDL_SCANCODE_KP_1, |
109 | /* 80 */ SDL_SCANCODE_KP_2, |
110 | /* 81 */ SDL_SCANCODE_KP_3, |
111 | /* 82 */ SDL_SCANCODE_KP_0, |
112 | /* 83 */ SDL_SCANCODE_KP_PERIOD, |
113 | 0, |
114 | /* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */ |
115 | /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */ |
116 | /* 87 */ SDL_SCANCODE_F11, |
117 | /* 88 */ SDL_SCANCODE_F12, |
118 | /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */ |
119 | /* 90 */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */ |
120 | /* 91 */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */ |
121 | /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */ |
122 | /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */ |
123 | /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */ |
124 | /* 95 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */ |
125 | /* 96 */ SDL_SCANCODE_KP_ENTER, |
126 | /* 97 */ SDL_SCANCODE_RCTRL, |
127 | /* 98 */ SDL_SCANCODE_KP_DIVIDE, |
128 | /* 99 */ SDL_SCANCODE_SYSREQ, |
129 | /* 100 */ SDL_SCANCODE_RALT, |
130 | /* 101 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */ |
131 | /* 102 */ SDL_SCANCODE_HOME, |
132 | /* 103 */ SDL_SCANCODE_UP, |
133 | /* 104 */ SDL_SCANCODE_PAGEUP, |
134 | /* 105 */ SDL_SCANCODE_LEFT, |
135 | /* 106 */ SDL_SCANCODE_RIGHT, |
136 | /* 107 */ SDL_SCANCODE_END, |
137 | /* 108 */ SDL_SCANCODE_DOWN, |
138 | /* 109 */ SDL_SCANCODE_PAGEDOWN, |
139 | /* 110 */ SDL_SCANCODE_INSERT, |
140 | /* 111 */ SDL_SCANCODE_DELETE, |
141 | /* 112 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */ |
142 | /* 113 */ SDL_SCANCODE_MUTE, |
143 | /* 114 */ SDL_SCANCODE_VOLUMEDOWN, |
144 | /* 115 */ SDL_SCANCODE_VOLUMEUP, |
145 | /* 116 */ SDL_SCANCODE_POWER, |
146 | /* 117 */ SDL_SCANCODE_KP_EQUALS, |
147 | /* 118 */ SDL_SCANCODE_KP_PLUSMINUS, |
148 | /* 119 */ SDL_SCANCODE_PAUSE, |
149 | 0, |
150 | /* 121 */ SDL_SCANCODE_KP_COMMA, |
151 | /* 122 */ SDL_SCANCODE_LANG1, /* KEY_HANGUEL */ |
152 | /* 123 */ SDL_SCANCODE_LANG2, /* KEY_HANJA */ |
153 | /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */ |
154 | /* 125 */ SDL_SCANCODE_LGUI, |
155 | /* 126 */ SDL_SCANCODE_RGUI, |
156 | /* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */ |
157 | /* 128 */ SDL_SCANCODE_STOP, |
158 | /* 129 */ SDL_SCANCODE_AGAIN, |
159 | /* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */ |
160 | /* 131 */ SDL_SCANCODE_UNDO, |
161 | /* 132 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */ |
162 | /* 133 */ SDL_SCANCODE_COPY, |
163 | /* 134 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */ |
164 | /* 135 */ SDL_SCANCODE_PASTE, |
165 | /* 136 */ SDL_SCANCODE_FIND, |
166 | /* 137 */ SDL_SCANCODE_CUT, |
167 | /* 138 */ SDL_SCANCODE_HELP, |
168 | /* 139 */ SDL_SCANCODE_MENU, |
169 | /* 140 */ SDL_SCANCODE_CALCULATOR, |
170 | /* 141 */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */ |
171 | /* 142 */ SDL_SCANCODE_SLEEP, |
172 | /* 143 */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */ |
173 | /* 144 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */ |
174 | /* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */ |
175 | /* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */ |
176 | /* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */ |
177 | /* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */ |
178 | /* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */ |
179 | /* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */ |
180 | /* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */ |
181 | /* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */ |
182 | /* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */ |
183 | /* 154 */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */ |
184 | /* 155 */ SDL_SCANCODE_MAIL, |
185 | /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, |
186 | /* 157 */ SDL_SCANCODE_COMPUTER, |
187 | /* 158 */ SDL_SCANCODE_AC_BACK, |
188 | /* 159 */ SDL_SCANCODE_AC_FORWARD, |
189 | /* 160 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */ |
190 | /* 161 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */ |
191 | /* 162 */ SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD */ |
192 | /* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */ |
193 | /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */ |
194 | /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ |
195 | /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ |
196 | /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ |
197 | /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ |
198 | /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ |
199 | /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ |
200 | /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ |
201 | /* 172 */ SDL_SCANCODE_AC_HOME, |
202 | /* 173 */ SDL_SCANCODE_AC_REFRESH, |
203 | /* 174 */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */ |
204 | /* 175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */ |
205 | /* 176 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */ |
206 | /* 177 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */ |
207 | /* 178 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */ |
208 | /* 179 */ SDL_SCANCODE_KP_LEFTPAREN, |
209 | /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, |
210 | /* 181 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */ |
211 | /* 182 */ SDL_SCANCODE_UNKNOWN, /* KEY_REDO */ |
212 | /* 183 */ SDL_SCANCODE_F13, |
213 | /* 184 */ SDL_SCANCODE_F14, |
214 | /* 185 */ SDL_SCANCODE_F15, |
215 | /* 186 */ SDL_SCANCODE_F16, |
216 | /* 187 */ SDL_SCANCODE_F17, |
217 | /* 188 */ SDL_SCANCODE_F18, |
218 | /* 189 */ SDL_SCANCODE_F19, |
219 | /* 190 */ SDL_SCANCODE_F20, |
220 | /* 191 */ SDL_SCANCODE_F21, |
221 | /* 192 */ SDL_SCANCODE_F22, |
222 | /* 193 */ SDL_SCANCODE_F23, |
223 | /* 194 */ SDL_SCANCODE_F24, |
224 | 0, 0, 0, 0, 0, |
225 | /* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */ |
226 | /* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */ |
227 | /* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */ |
228 | /* 203 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */ |
229 | 0, |
230 | /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ |
231 | /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ |
232 | /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ |
233 | /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ |
234 | /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ |
235 | /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ |
236 | /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ |
237 | /* 212 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */ |
238 | /* 213 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */ |
239 | /* 214 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */ |
240 | /* 215 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL */ |
241 | /* 216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */ |
242 | /* 217 */ SDL_SCANCODE_AC_SEARCH, |
243 | /* 218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */ |
244 | /* 219 */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */ |
245 | /* 220 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */ |
246 | /* 221 */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */ |
247 | /* 222 */ SDL_SCANCODE_ALTERASE, |
248 | /* 223 */ SDL_SCANCODE_CANCEL, |
249 | /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN, |
250 | /* 225 */ SDL_SCANCODE_BRIGHTNESSUP, |
251 | /* 226 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA */ |
252 | /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */ |
253 | /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE, |
254 | /* 229 */ SDL_SCANCODE_KBDILLUMDOWN, |
255 | /* 230 */ SDL_SCANCODE_KBDILLUMUP, |
256 | /* 231 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */ |
257 | /* 232 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */ |
258 | /* 233 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */ |
259 | /* 234 */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */ |
260 | /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ |
261 | /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ |
262 | }; |
263 | /* *INDENT-ON* */ |
264 | |