2 /* map SDL2 scancodes to QKeyCode */
4 static const int sdl2_scancode_to_qcode
[SDL_NUM_SCANCODES
] = {
5 [SDL_SCANCODE_A
] = Q_KEY_CODE_A
,
6 [SDL_SCANCODE_B
] = Q_KEY_CODE_B
,
7 [SDL_SCANCODE_C
] = Q_KEY_CODE_C
,
8 [SDL_SCANCODE_D
] = Q_KEY_CODE_D
,
9 [SDL_SCANCODE_E
] = Q_KEY_CODE_E
,
10 [SDL_SCANCODE_F
] = Q_KEY_CODE_F
,
11 [SDL_SCANCODE_G
] = Q_KEY_CODE_G
,
12 [SDL_SCANCODE_H
] = Q_KEY_CODE_H
,
13 [SDL_SCANCODE_I
] = Q_KEY_CODE_I
,
14 [SDL_SCANCODE_J
] = Q_KEY_CODE_J
,
15 [SDL_SCANCODE_K
] = Q_KEY_CODE_K
,
16 [SDL_SCANCODE_L
] = Q_KEY_CODE_L
,
17 [SDL_SCANCODE_M
] = Q_KEY_CODE_M
,
18 [SDL_SCANCODE_N
] = Q_KEY_CODE_N
,
19 [SDL_SCANCODE_O
] = Q_KEY_CODE_O
,
20 [SDL_SCANCODE_P
] = Q_KEY_CODE_P
,
21 [SDL_SCANCODE_Q
] = Q_KEY_CODE_Q
,
22 [SDL_SCANCODE_R
] = Q_KEY_CODE_R
,
23 [SDL_SCANCODE_S
] = Q_KEY_CODE_S
,
24 [SDL_SCANCODE_T
] = Q_KEY_CODE_T
,
25 [SDL_SCANCODE_U
] = Q_KEY_CODE_U
,
26 [SDL_SCANCODE_V
] = Q_KEY_CODE_V
,
27 [SDL_SCANCODE_W
] = Q_KEY_CODE_W
,
28 [SDL_SCANCODE_X
] = Q_KEY_CODE_X
,
29 [SDL_SCANCODE_Y
] = Q_KEY_CODE_Y
,
30 [SDL_SCANCODE_Z
] = Q_KEY_CODE_Z
,
32 [SDL_SCANCODE_1
] = Q_KEY_CODE_1
,
33 [SDL_SCANCODE_2
] = Q_KEY_CODE_2
,
34 [SDL_SCANCODE_3
] = Q_KEY_CODE_3
,
35 [SDL_SCANCODE_4
] = Q_KEY_CODE_4
,
36 [SDL_SCANCODE_5
] = Q_KEY_CODE_5
,
37 [SDL_SCANCODE_6
] = Q_KEY_CODE_6
,
38 [SDL_SCANCODE_7
] = Q_KEY_CODE_7
,
39 [SDL_SCANCODE_8
] = Q_KEY_CODE_8
,
40 [SDL_SCANCODE_9
] = Q_KEY_CODE_9
,
41 [SDL_SCANCODE_0
] = Q_KEY_CODE_0
,
43 [SDL_SCANCODE_RETURN
] = Q_KEY_CODE_RET
,
44 [SDL_SCANCODE_ESCAPE
] = Q_KEY_CODE_ESC
,
45 [SDL_SCANCODE_BACKSPACE
] = Q_KEY_CODE_BACKSPACE
,
46 [SDL_SCANCODE_TAB
] = Q_KEY_CODE_TAB
,
47 [SDL_SCANCODE_SPACE
] = Q_KEY_CODE_SPC
,
48 [SDL_SCANCODE_MINUS
] = Q_KEY_CODE_MINUS
,
49 [SDL_SCANCODE_EQUALS
] = Q_KEY_CODE_EQUAL
,
50 [SDL_SCANCODE_LEFTBRACKET
] = Q_KEY_CODE_BRACKET_LEFT
,
51 [SDL_SCANCODE_RIGHTBRACKET
] = Q_KEY_CODE_BRACKET_RIGHT
,
52 [SDL_SCANCODE_BACKSLASH
] = Q_KEY_CODE_BACKSLASH
,
54 [SDL_SCANCODE_NONUSHASH
] = Q_KEY_CODE_NONUSHASH
,
56 [SDL_SCANCODE_SEMICOLON
] = Q_KEY_CODE_SEMICOLON
,
57 [SDL_SCANCODE_APOSTROPHE
] = Q_KEY_CODE_APOSTROPHE
,
58 [SDL_SCANCODE_GRAVE
] = Q_KEY_CODE_GRAVE_ACCENT
,
59 [SDL_SCANCODE_COMMA
] = Q_KEY_CODE_COMMA
,
60 [SDL_SCANCODE_PERIOD
] = Q_KEY_CODE_DOT
,
61 [SDL_SCANCODE_SLASH
] = Q_KEY_CODE_SLASH
,
62 [SDL_SCANCODE_CAPSLOCK
] = Q_KEY_CODE_CAPS_LOCK
,
64 [SDL_SCANCODE_F1
] = Q_KEY_CODE_F1
,
65 [SDL_SCANCODE_F2
] = Q_KEY_CODE_F2
,
66 [SDL_SCANCODE_F3
] = Q_KEY_CODE_F3
,
67 [SDL_SCANCODE_F4
] = Q_KEY_CODE_F4
,
68 [SDL_SCANCODE_F5
] = Q_KEY_CODE_F5
,
69 [SDL_SCANCODE_F6
] = Q_KEY_CODE_F6
,
70 [SDL_SCANCODE_F7
] = Q_KEY_CODE_F7
,
71 [SDL_SCANCODE_F8
] = Q_KEY_CODE_F8
,
72 [SDL_SCANCODE_F9
] = Q_KEY_CODE_F9
,
73 [SDL_SCANCODE_F10
] = Q_KEY_CODE_F10
,
74 [SDL_SCANCODE_F11
] = Q_KEY_CODE_F11
,
75 [SDL_SCANCODE_F12
] = Q_KEY_CODE_F12
,
77 [SDL_SCANCODE_PRINTSCREEN
] = Q_KEY_CODE_PRINT
,
78 [SDL_SCANCODE_SCROLLLOCK
] = Q_KEY_CODE_SCROLL_LOCK
,
79 [SDL_SCANCODE_PAUSE
] = Q_KEY_CODE_PAUSE
,
80 [SDL_SCANCODE_INSERT
] = Q_KEY_CODE_INSERT
,
81 [SDL_SCANCODE_HOME
] = Q_KEY_CODE_HOME
,
82 [SDL_SCANCODE_PAGEUP
] = Q_KEY_CODE_PGUP
,
83 [SDL_SCANCODE_DELETE
] = Q_KEY_CODE_DELETE
,
84 [SDL_SCANCODE_END
] = Q_KEY_CODE_END
,
85 [SDL_SCANCODE_PAGEDOWN
] = Q_KEY_CODE_PGDN
,
86 [SDL_SCANCODE_RIGHT
] = Q_KEY_CODE_RIGHT
,
87 [SDL_SCANCODE_LEFT
] = Q_KEY_CODE_LEFT
,
88 [SDL_SCANCODE_DOWN
] = Q_KEY_CODE_DOWN
,
89 [SDL_SCANCODE_UP
] = Q_KEY_CODE_UP
,
90 [SDL_SCANCODE_NUMLOCKCLEAR
] = Q_KEY_CODE_NUM_LOCK
,
92 [SDL_SCANCODE_KP_DIVIDE
] = Q_KEY_CODE_KP_DIVIDE
,
93 [SDL_SCANCODE_KP_MULTIPLY
] = Q_KEY_CODE_KP_MULTIPLY
,
94 [SDL_SCANCODE_KP_MINUS
] = Q_KEY_CODE_KP_SUBTRACT
,
95 [SDL_SCANCODE_KP_PLUS
] = Q_KEY_CODE_KP_ADD
,
96 [SDL_SCANCODE_KP_ENTER
] = Q_KEY_CODE_KP_ENTER
,
97 [SDL_SCANCODE_KP_1
] = Q_KEY_CODE_KP_1
,
98 [SDL_SCANCODE_KP_2
] = Q_KEY_CODE_KP_2
,
99 [SDL_SCANCODE_KP_3
] = Q_KEY_CODE_KP_3
,
100 [SDL_SCANCODE_KP_4
] = Q_KEY_CODE_KP_4
,
101 [SDL_SCANCODE_KP_5
] = Q_KEY_CODE_KP_5
,
102 [SDL_SCANCODE_KP_6
] = Q_KEY_CODE_KP_6
,
103 [SDL_SCANCODE_KP_7
] = Q_KEY_CODE_KP_7
,
104 [SDL_SCANCODE_KP_8
] = Q_KEY_CODE_KP_8
,
105 [SDL_SCANCODE_KP_9
] = Q_KEY_CODE_KP_9
,
106 [SDL_SCANCODE_KP_0
] = Q_KEY_CODE_KP_0
,
107 [SDL_SCANCODE_KP_PERIOD
] = Q_KEY_CODE_KP_DECIMAL
,
109 [SDL_SCANCODE_NONUSBACKSLASH
] = Q_KEY_CODE_LESS
,
110 [SDL_SCANCODE_APPLICATION
] = Q_KEY_CODE_MENU
,
112 [SDL_SCANCODE_POWER
] = Q_KEY_CODE_POWER
,
113 [SDL_SCANCODE_KP_EQUALS
] = Q_KEY_CODE_KP_EQUALS
,
115 [SDL_SCANCODE_F13
] = Q_KEY_CODE_F13
,
116 [SDL_SCANCODE_F14
] = Q_KEY_CODE_F14
,
117 [SDL_SCANCODE_F15
] = Q_KEY_CODE_F15
,
118 [SDL_SCANCODE_F16
] = Q_KEY_CODE_F16
,
119 [SDL_SCANCODE_F17
] = Q_KEY_CODE_F17
,
120 [SDL_SCANCODE_F18
] = Q_KEY_CODE_F18
,
121 [SDL_SCANCODE_F19
] = Q_KEY_CODE_F19
,
122 [SDL_SCANCODE_F20
] = Q_KEY_CODE_F20
,
123 [SDL_SCANCODE_F21
] = Q_KEY_CODE_F21
,
124 [SDL_SCANCODE_F22
] = Q_KEY_CODE_F22
,
125 [SDL_SCANCODE_F23
] = Q_KEY_CODE_F23
,
126 [SDL_SCANCODE_F24
] = Q_KEY_CODE_F24
,
128 [SDL_SCANCODE_EXECUTE
] = Q_KEY_CODE_EXECUTE
,
130 [SDL_SCANCODE_HELP
] = Q_KEY_CODE_HELP
,
131 [SDL_SCANCODE_MENU
] = Q_KEY_CODE_MENU
,
133 [SDL_SCANCODE_SELECT
] = Q_KEY_CODE_SELECT
,
135 [SDL_SCANCODE_STOP
] = Q_KEY_CODE_STOP
,
136 [SDL_SCANCODE_AGAIN
] = Q_KEY_CODE_AGAIN
,
137 [SDL_SCANCODE_UNDO
] = Q_KEY_CODE_UNDO
,
138 [SDL_SCANCODE_CUT
] = Q_KEY_CODE_CUT
,
139 [SDL_SCANCODE_COPY
] = Q_KEY_CODE_COPY
,
140 [SDL_SCANCODE_PASTE
] = Q_KEY_CODE_PASTE
,
141 [SDL_SCANCODE_FIND
] = Q_KEY_CODE_FIND
,
143 [SDL_SCANCODE_MUTE
] = Q_KEY_CODE_MUTE
,
144 [SDL_SCANCODE_VOLUMEUP
] = Q_KEY_CODE_VOLUMEUP
,
145 [SDL_SCANCODE_VOLUMEDOWN
] = Q_KEY_CODE_VOLUMEDOWN
,
147 [SDL_SCANCODE_KP_COMMA
] = Q_KEY_CODE_KP_COMMA
,
148 [SDL_SCANCODE_KP_EQUALSAS400
] = Q_KEY_CODE_KP_EQUALSAS400
,
150 [SDL_SCANCODE_INTERNATIONAL1
] = Q_KEY_CODE_INTERNATIONAL1
,
151 [SDL_SCANCODE_INTERNATIONAL2
] = Q_KEY_CODE_INTERNATIONAL2
,
152 [SDL_SCANCODE_INTERNATIONAL3
] = Q_KEY_CODE_INTERNATIONAL3
,
153 [SDL_SCANCODE_INTERNATIONAL4
] = Q_KEY_CODE_INTERNATIONAL4
,
154 [SDL_SCANCODE_INTERNATIONAL5
] = Q_KEY_CODE_INTERNATIONAL5
,
155 [SDL_SCANCODE_INTERNATIONAL6
] = Q_KEY_CODE_INTERNATIONAL6
,
156 [SDL_SCANCODE_INTERNATIONAL7
] = Q_KEY_CODE_INTERNATIONAL7
,
157 [SDL_SCANCODE_INTERNATIONAL8
] = Q_KEY_CODE_INTERNATIONAL8
,
158 [SDL_SCANCODE_INTERNATIONAL9
] = Q_KEY_CODE_INTERNATIONAL9
,
159 [SDL_SCANCODE_LANG1
] = Q_KEY_CODE_LANG1
,
160 [SDL_SCANCODE_LANG2
] = Q_KEY_CODE_LANG2
,
161 [SDL_SCANCODE_LANG3
] = Q_KEY_CODE_LANG3
,
162 [SDL_SCANCODE_LANG4
] = Q_KEY_CODE_LANG4
,
163 [SDL_SCANCODE_LANG5
] = Q_KEY_CODE_LANG5
,
164 [SDL_SCANCODE_LANG6
] = Q_KEY_CODE_LANG6
,
165 [SDL_SCANCODE_LANG7
] = Q_KEY_CODE_LANG7
,
166 [SDL_SCANCODE_LANG8
] = Q_KEY_CODE_LANG8
,
167 [SDL_SCANCODE_LANG9
] = Q_KEY_CODE_LANG9
,
168 [SDL_SCANCODE_ALTERASE
] = Q_KEY_CODE_ALTERASE
,
170 [SDL_SCANCODE_SYSREQ
] = Q_KEY_CODE_SYSRQ
,
172 [SDL_SCANCODE_CANCEL
] = Q_KEY_CODE_CANCEL
,
173 [SDL_SCANCODE_CLEAR
] = Q_KEY_CODE_CLEAR
,
174 [SDL_SCANCODE_PRIOR
] = Q_KEY_CODE_PRIOR
,
175 [SDL_SCANCODE_RETURN2
] = Q_KEY_CODE_RETURN2
,
176 [SDL_SCANCODE_SEPARATOR
] = Q_KEY_CODE_SEPARATOR
,
177 [SDL_SCANCODE_OUT
] = Q_KEY_CODE_OUT
,
178 [SDL_SCANCODE_OPER
] = Q_KEY_CODE_OPER
,
179 [SDL_SCANCODE_CLEARAGAIN
] = Q_KEY_CODE_CLEARAGAIN
,
180 [SDL_SCANCODE_CRSEL
] = Q_KEY_CODE_CRSEL
,
181 [SDL_SCANCODE_EXSEL
] = Q_KEY_CODE_EXSEL
,
182 [SDL_SCANCODE_KP_00
] = Q_KEY_CODE_KP_00
,
183 [SDL_SCANCODE_KP_000
] = Q_KEY_CODE_KP_000
,
184 [SDL_SCANCODE_THOUSANDSSEPARATOR
] = Q_KEY_CODE_THOUSANDSSEPARATOR
,
185 [SDL_SCANCODE_DECIMALSEPARATOR
] = Q_KEY_CODE_DECIMALSEPARATOR
,
186 [SDL_SCANCODE_CURRENCYUNIT
] = Q_KEY_CODE_CURRENCYUNIT
,
187 [SDL_SCANCODE_CURRENCYSUBUNIT
] = Q_KEY_CODE_CURRENCYSUBUNIT
,
188 [SDL_SCANCODE_KP_LEFTPAREN
] = Q_KEY_CODE_KP_LEFTPAREN
,
189 [SDL_SCANCODE_KP_RIGHTPAREN
] = Q_KEY_CODE_KP_RIGHTPAREN
,
190 [SDL_SCANCODE_KP_LEFTBRACE
] = Q_KEY_CODE_KP_LEFTBRACE
,
191 [SDL_SCANCODE_KP_RIGHTBRACE
] = Q_KEY_CODE_KP_RIGHTBRACE
,
192 [SDL_SCANCODE_KP_TAB
] = Q_KEY_CODE_KP_TAB
,
193 [SDL_SCANCODE_KP_BACKSPACE
] = Q_KEY_CODE_KP_BACKSPACE
,
194 [SDL_SCANCODE_KP_A
] = Q_KEY_CODE_KP_A
,
195 [SDL_SCANCODE_KP_B
] = Q_KEY_CODE_KP_B
,
196 [SDL_SCANCODE_KP_C
] = Q_KEY_CODE_KP_C
,
197 [SDL_SCANCODE_KP_D
] = Q_KEY_CODE_KP_D
,
198 [SDL_SCANCODE_KP_E
] = Q_KEY_CODE_KP_E
,
199 [SDL_SCANCODE_KP_F
] = Q_KEY_CODE_KP_F
,
200 [SDL_SCANCODE_KP_XOR
] = Q_KEY_CODE_KP_XOR
,
201 [SDL_SCANCODE_KP_POWER
] = Q_KEY_CODE_KP_POWER
,
202 [SDL_SCANCODE_KP_PERCENT
] = Q_KEY_CODE_KP_PERCENT
,
203 [SDL_SCANCODE_KP_LESS
] = Q_KEY_CODE_KP_LESS
,
204 [SDL_SCANCODE_KP_GREATER
] = Q_KEY_CODE_KP_GREATER
,
205 [SDL_SCANCODE_KP_AMPERSAND
] = Q_KEY_CODE_KP_AMPERSAND
,
206 [SDL_SCANCODE_KP_DBLAMPERSAND
] = Q_KEY_CODE_KP_DBLAMPERSAND
,
207 [SDL_SCANCODE_KP_VERTICALBAR
] = Q_KEY_CODE_KP_VERTICALBAR
,
208 [SDL_SCANCODE_KP_DBLVERTICALBAR
] = Q_KEY_CODE_KP_DBLVERTICALBAR
,
209 [SDL_SCANCODE_KP_COLON
] = Q_KEY_CODE_KP_COLON
,
210 [SDL_SCANCODE_KP_HASH
] = Q_KEY_CODE_KP_HASH
,
211 [SDL_SCANCODE_KP_SPACE
] = Q_KEY_CODE_KP_SPACE
,
212 [SDL_SCANCODE_KP_AT
] = Q_KEY_CODE_KP_AT
,
213 [SDL_SCANCODE_KP_EXCLAM
] = Q_KEY_CODE_KP_EXCLAM
,
214 [SDL_SCANCODE_KP_MEMSTORE
] = Q_KEY_CODE_KP_MEMSTORE
,
215 [SDL_SCANCODE_KP_MEMRECALL
] = Q_KEY_CODE_KP_MEMRECALL
,
216 [SDL_SCANCODE_KP_MEMCLEAR
] = Q_KEY_CODE_KP_MEMCLEAR
,
217 [SDL_SCANCODE_KP_MEMADD
] = Q_KEY_CODE_KP_MEMADD
,
218 [SDL_SCANCODE_KP_MEMSUBTRACT
] = Q_KEY_CODE_KP_MEMSUBTRACT
,
219 [SDL_SCANCODE_KP_MEMMULTIPLY
] = Q_KEY_CODE_KP_MEMMULTIPLY
,
220 [SDL_SCANCODE_KP_MEMDIVIDE
] = Q_KEY_CODE_KP_MEMDIVIDE
,
221 [SDL_SCANCODE_KP_PLUSMINUS
] = Q_KEY_CODE_KP_PLUSMINUS
,
222 [SDL_SCANCODE_KP_CLEAR
] = Q_KEY_CODE_KP_CLEAR
,
223 [SDL_SCANCODE_KP_CLEARENTRY
] = Q_KEY_CODE_KP_CLEARENTRY
,
224 [SDL_SCANCODE_KP_BINARY
] = Q_KEY_CODE_KP_BINARY
,
225 [SDL_SCANCODE_KP_OCTAL
] = Q_KEY_CODE_KP_OCTAL
,
226 [SDL_SCANCODE_KP_DECIMAL
] = Q_KEY_CODE_KP_DECIMAL
,
227 [SDL_SCANCODE_KP_HEXADECIMAL
] = Q_KEY_CODE_KP_HEXADECIMAL
,
229 [SDL_SCANCODE_LCTRL
] = Q_KEY_CODE_CTRL
,
230 [SDL_SCANCODE_LSHIFT
] = Q_KEY_CODE_SHIFT
,
231 [SDL_SCANCODE_LALT
] = Q_KEY_CODE_ALT
,
232 [SDL_SCANCODE_LGUI
] = Q_KEY_CODE_META_L
,
233 [SDL_SCANCODE_RCTRL
] = Q_KEY_CODE_CTRL_R
,
234 [SDL_SCANCODE_RSHIFT
] = Q_KEY_CODE_SHIFT_R
,
235 [SDL_SCANCODE_RALT
] = Q_KEY_CODE_ALT_R
,
236 [SDL_SCANCODE_RGUI
] = Q_KEY_CODE_META_R
,
238 [SDL_SCANCODE_MODE
] = Q_KEY_CODE_MODE
,
239 [SDL_SCANCODE_AUDIONEXT
] = Q_KEY_CODE_AUDIONEXT
,
240 [SDL_SCANCODE_AUDIOPREV
] = Q_KEY_CODE_AUDIOPREV
,
241 [SDL_SCANCODE_AUDIOSTOP
] = Q_KEY_CODE_AUDIOSTOP
,
242 [SDL_SCANCODE_AUDIOPLAY
] = Q_KEY_CODE_AUDIOPLAY
,
243 [SDL_SCANCODE_AUDIOMUTE
] = Q_KEY_CODE_AUDIOMUTE
,
244 [SDL_SCANCODE_MEDIASELECT
] = Q_KEY_CODE_MEDIASELECT
,
245 [SDL_SCANCODE_WWW
] = Q_KEY_CODE_WWW
,
246 [SDL_SCANCODE_MAIL
] = Q_KEY_CODE_MAIL
,
247 [SDL_SCANCODE_CALCULATOR
] = Q_KEY_CODE_CALCULATOR
,
248 [SDL_SCANCODE_COMPUTER
] = Q_KEY_CODE_COMPUTER
,
249 [SDL_SCANCODE_AC_SEARCH
] = Q_KEY_CODE_AC_SEARCH
,
250 [SDL_SCANCODE_AC_HOME
] = Q_KEY_CODE_AC_HOME
,
251 [SDL_SCANCODE_AC_BACK
] = Q_KEY_CODE_AC_BACK
,
252 [SDL_SCANCODE_AC_FORWARD
] = Q_KEY_CODE_AC_FORWARD
,
253 [SDL_SCANCODE_AC_STOP
] = Q_KEY_CODE_AC_STOP
,
254 [SDL_SCANCODE_AC_REFRESH
] = Q_KEY_CODE_AC_REFRESH
,
255 [SDL_SCANCODE_AC_BOOKMARKS
] = Q_KEY_CODE_AC_BOOKMARKS
,
256 [SDL_SCANCODE_BRIGHTNESSDOWN
] = Q_KEY_CODE_BRIGHTNESSDOWN
,
257 [SDL_SCANCODE_BRIGHTNESSUP
] = Q_KEY_CODE_BRIGHTNESSUP
,
258 [SDL_SCANCODE_DISPLAYSWITCH
] = Q_KEY_CODE_DISPLAYSWITCH
,
259 [SDL_SCANCODE_KBDILLUMTOGGLE
] = Q_KEY_CODE_KBDILLUMTOGGLE
,
260 [SDL_SCANCODE_KBDILLUMDOWN
] = Q_KEY_CODE_KBDILLUMDOWN
,
261 [SDL_SCANCODE_KBDILLUMUP
] = Q_KEY_CODE_KBDILLUMUP
,
262 [SDL_SCANCODE_EJECT
] = Q_KEY_CODE_EJECT
,
263 [SDL_SCANCODE_SLEEP
] = Q_KEY_CODE_SLEEP
,
264 [SDL_SCANCODE_APP1
] = Q_KEY_CODE_APP1
,
265 [SDL_SCANCODE_APP2
] = Q_KEY_CODE_APP2
,