SDL 2.0
scancodes_darwin.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 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
22/* Mac virtual key code to SDL scancode mapping table
23 Sources:
24 - Inside Macintosh: Text <http://developer.apple.com/documentation/mac/Text/Text-571.html>
25 - Apple USB keyboard driver source <http://darwinsource.opendarwin.org/10.4.6.ppc/IOHIDFamily-172.8/IOHIDFamily/Cosmo_USB2ADB.c>
26 - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
27*/
28/* *INDENT-OFF* */
30 /* 0 */ SDL_SCANCODE_A,
31 /* 1 */ SDL_SCANCODE_S,
32 /* 2 */ SDL_SCANCODE_D,
33 /* 3 */ SDL_SCANCODE_F,
34 /* 4 */ SDL_SCANCODE_H,
35 /* 5 */ SDL_SCANCODE_G,
36 /* 6 */ SDL_SCANCODE_Z,
37 /* 7 */ SDL_SCANCODE_X,
38 /* 8 */ SDL_SCANCODE_C,
39 /* 9 */ SDL_SCANCODE_V,
40 /* 10 */ SDL_SCANCODE_NONUSBACKSLASH, /* SDL_SCANCODE_NONUSBACKSLASH on ANSI and JIS keyboards (if this key would exist there), SDL_SCANCODE_GRAVE on ISO. (The USB keyboard driver actually translates these usage codes to different virtual key codes depending on whether the keyboard is ISO/ANSI/JIS. That's why you have to help it identify the keyboard type when you plug in a PC USB keyboard. It's a historical thing - ADB keyboards are wired this way.) */
41 /* 11 */ SDL_SCANCODE_B,
42 /* 12 */ SDL_SCANCODE_Q,
43 /* 13 */ SDL_SCANCODE_W,
44 /* 14 */ SDL_SCANCODE_E,
45 /* 15 */ SDL_SCANCODE_R,
46 /* 16 */ SDL_SCANCODE_Y,
47 /* 17 */ SDL_SCANCODE_T,
48 /* 18 */ SDL_SCANCODE_1,
49 /* 19 */ SDL_SCANCODE_2,
50 /* 20 */ SDL_SCANCODE_3,
51 /* 21 */ SDL_SCANCODE_4,
52 /* 22 */ SDL_SCANCODE_6,
53 /* 23 */ SDL_SCANCODE_5,
54 /* 24 */ SDL_SCANCODE_EQUALS,
55 /* 25 */ SDL_SCANCODE_9,
56 /* 26 */ SDL_SCANCODE_7,
57 /* 27 */ SDL_SCANCODE_MINUS,
58 /* 28 */ SDL_SCANCODE_8,
59 /* 29 */ SDL_SCANCODE_0,
61 /* 31 */ SDL_SCANCODE_O,
62 /* 32 */ SDL_SCANCODE_U,
64 /* 34 */ SDL_SCANCODE_I,
65 /* 35 */ SDL_SCANCODE_P,
66 /* 36 */ SDL_SCANCODE_RETURN,
67 /* 37 */ SDL_SCANCODE_L,
68 /* 38 */ SDL_SCANCODE_J,
70 /* 40 */ SDL_SCANCODE_K,
73 /* 43 */ SDL_SCANCODE_COMMA,
74 /* 44 */ SDL_SCANCODE_SLASH,
75 /* 45 */ SDL_SCANCODE_N,
76 /* 46 */ SDL_SCANCODE_M,
77 /* 47 */ SDL_SCANCODE_PERIOD,
78 /* 48 */ SDL_SCANCODE_TAB,
79 /* 49 */ SDL_SCANCODE_SPACE,
80 /* 50 */ SDL_SCANCODE_GRAVE, /* SDL_SCANCODE_GRAVE on ANSI and JIS keyboards, SDL_SCANCODE_NONUSBACKSLASH on ISO (see comment about virtual key code 10 above) */
82 /* 52 */ SDL_SCANCODE_KP_ENTER, /* keyboard enter on portables */
83 /* 53 */ SDL_SCANCODE_ESCAPE,
84 /* 54 */ SDL_SCANCODE_RGUI,
85 /* 55 */ SDL_SCANCODE_LGUI,
86 /* 56 */ SDL_SCANCODE_LSHIFT,
87 /* 57 */ SDL_SCANCODE_CAPSLOCK,
88 /* 58 */ SDL_SCANCODE_LALT,
89 /* 59 */ SDL_SCANCODE_LCTRL,
90 /* 60 */ SDL_SCANCODE_RSHIFT,
91 /* 61 */ SDL_SCANCODE_RALT,
92 /* 62 */ SDL_SCANCODE_RCTRL,
93 /* 63 */ SDL_SCANCODE_RGUI, /* fn on portables, acts as a hardware-level modifier already, so we don't generate events for it, also XK_Meta_R */
94 /* 64 */ SDL_SCANCODE_F17,
96 /* 66 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
98 /* 68 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
99 /* 69 */ SDL_SCANCODE_KP_PLUS,
100 /* 70 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
102 /* 72 */ SDL_SCANCODE_VOLUMEUP,
104 /* 74 */ SDL_SCANCODE_MUTE,
105 /* 75 */ SDL_SCANCODE_KP_DIVIDE,
106 /* 76 */ SDL_SCANCODE_KP_ENTER, /* keypad enter on external keyboards, fn-return on portables */
107 /* 77 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
108 /* 78 */ SDL_SCANCODE_KP_MINUS,
109 /* 79 */ SDL_SCANCODE_F18,
110 /* 80 */ SDL_SCANCODE_F19,
111 /* 81 */ SDL_SCANCODE_KP_EQUALS,
112 /* 82 */ SDL_SCANCODE_KP_0,
113 /* 83 */ SDL_SCANCODE_KP_1,
114 /* 84 */ SDL_SCANCODE_KP_2,
115 /* 85 */ SDL_SCANCODE_KP_3,
116 /* 86 */ SDL_SCANCODE_KP_4,
117 /* 87 */ SDL_SCANCODE_KP_5,
118 /* 88 */ SDL_SCANCODE_KP_6,
119 /* 89 */ SDL_SCANCODE_KP_7,
120 /* 90 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
121 /* 91 */ SDL_SCANCODE_KP_8,
122 /* 92 */ SDL_SCANCODE_KP_9,
123 /* 93 */ SDL_SCANCODE_INTERNATIONAL3, /* Cosmo_USB2ADB.c says "Yen (JIS)" */
124 /* 94 */ SDL_SCANCODE_INTERNATIONAL1, /* Cosmo_USB2ADB.c says "Ro (JIS)" */
125 /* 95 */ SDL_SCANCODE_KP_COMMA, /* Cosmo_USB2ADB.c says ", JIS only" */
126 /* 96 */ SDL_SCANCODE_F5,
127 /* 97 */ SDL_SCANCODE_F6,
128 /* 98 */ SDL_SCANCODE_F7,
129 /* 99 */ SDL_SCANCODE_F3,
130 /* 100 */ SDL_SCANCODE_F8,
131 /* 101 */ SDL_SCANCODE_F9,
132 /* 102 */ SDL_SCANCODE_LANG2, /* Cosmo_USB2ADB.c says "Eisu" */
133 /* 103 */ SDL_SCANCODE_F11,
134 /* 104 */ SDL_SCANCODE_LANG1, /* Cosmo_USB2ADB.c says "Kana" */
135 /* 105 */ SDL_SCANCODE_PRINTSCREEN, /* On ADB keyboards, this key is labeled "F13/print screen". Problem: USB has different usage codes for these two functions. On Apple USB keyboards, the key is labeled "F13" and sends the F13 usage code (SDL_SCANCODE_F13). I decided to use SDL_SCANCODE_PRINTSCREEN here nevertheless since SDL applications are more likely to assume the presence of a print screen key than an F13 key. */
136 /* 106 */ SDL_SCANCODE_F16,
137 /* 107 */ SDL_SCANCODE_SCROLLLOCK, /* F14/scroll lock, see comment about F13/print screen above */
138 /* 108 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
139 /* 109 */ SDL_SCANCODE_F10,
140 /* 110 */ SDL_SCANCODE_APPLICATION, /* windows contextual menu key, fn-enter on portables */
141 /* 111 */ SDL_SCANCODE_F12,
142 /* 112 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
143 /* 113 */ SDL_SCANCODE_PAUSE, /* F15/pause, see comment about F13/print screen above */
144 /* 114 */ SDL_SCANCODE_INSERT, /* the key is actually labeled "help" on Apple keyboards, and works as such in Mac OS, but it sends the "insert" usage code even on Apple USB keyboards */
145 /* 115 */ SDL_SCANCODE_HOME,
146 /* 116 */ SDL_SCANCODE_PAGEUP,
147 /* 117 */ SDL_SCANCODE_DELETE,
148 /* 118 */ SDL_SCANCODE_F4,
149 /* 119 */ SDL_SCANCODE_END,
150 /* 120 */ SDL_SCANCODE_F2,
151 /* 121 */ SDL_SCANCODE_PAGEDOWN,
152 /* 122 */ SDL_SCANCODE_F1,
153 /* 123 */ SDL_SCANCODE_LEFT,
154 /* 124 */ SDL_SCANCODE_RIGHT,
155 /* 125 */ SDL_SCANCODE_DOWN,
156 /* 126 */ SDL_SCANCODE_UP,
157 /* 127 */ SDL_SCANCODE_POWER
158};
159/* *INDENT-ON* */
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:44
@ SDL_SCANCODE_E
Definition: SDL_scancode.h:58
@ SDL_SCANCODE_END
Definition: SDL_scancode.h:174
@ SDL_SCANCODE_BACKSLASH
Definition: SDL_scancode.h:102
@ SDL_SCANCODE_ESCAPE
Definition: SDL_scancode.h:93
@ SDL_SCANCODE_M
Definition: SDL_scancode.h:66
@ SDL_SCANCODE_F12
Definition: SDL_scancode.h:164
@ SDL_SCANCODE_X
Definition: SDL_scancode.h:77
@ SDL_SCANCODE_W
Definition: SDL_scancode.h:76
@ SDL_SCANCODE_KP_PLUS
Definition: SDL_scancode.h:186
@ SDL_SCANCODE_F4
Definition: SDL_scancode.h:156
@ SDL_SCANCODE_RIGHTBRACKET
Definition: SDL_scancode.h:101
@ SDL_SCANCODE_INTERNATIONAL1
Definition: SDL_scancode.h:248
@ SDL_SCANCODE_LANG2
Definition: SDL_scancode.h:259
@ SDL_SCANCODE_CAPSLOCK
Definition: SDL_scancode.h:151
@ SDL_SCANCODE_B
Definition: SDL_scancode.h:55
@ SDL_SCANCODE_F2
Definition: SDL_scancode.h:154
@ SDL_SCANCODE_KP_MINUS
Definition: SDL_scancode.h:185
@ SDL_SCANCODE_F6
Definition: SDL_scancode.h:158
@ SDL_SCANCODE_NONUSBACKSLASH
Definition: SDL_scancode.h:200
@ SDL_SCANCODE_KP_0
Definition: SDL_scancode.h:197
@ SDL_SCANCODE_F11
Definition: SDL_scancode.h:163
@ SDL_SCANCODE_COMMA
Definition: SDL_scancode.h:147
@ SDL_SCANCODE_KP_PERIOD
Definition: SDL_scancode.h:198
@ SDL_SCANCODE_Y
Definition: SDL_scancode.h:78
@ SDL_SCANCODE_APOSTROPHE
Definition: SDL_scancode.h:129
@ SDL_SCANCODE_KP_COMMA
Definition: SDL_scancode.h:245
@ SDL_SCANCODE_2
Definition: SDL_scancode.h:82
@ SDL_SCANCODE_O
Definition: SDL_scancode.h:68
@ SDL_SCANCODE_RGUI
Definition: SDL_scancode.h:335
@ SDL_SCANCODE_K
Definition: SDL_scancode.h:64
@ SDL_SCANCODE_F
Definition: SDL_scancode.h:59
@ SDL_SCANCODE_DELETE
Definition: SDL_scancode.h:173
@ SDL_SCANCODE_F10
Definition: SDL_scancode.h:162
@ SDL_SCANCODE_F3
Definition: SDL_scancode.h:155
@ SDL_SCANCODE_5
Definition: SDL_scancode.h:85
@ SDL_SCANCODE_H
Definition: SDL_scancode.h:61
@ SDL_SCANCODE_SLASH
Definition: SDL_scancode.h:149
@ SDL_SCANCODE_F1
Definition: SDL_scancode.h:153
@ SDL_SCANCODE_KP_EQUALS
Definition: SDL_scancode.h:214
@ SDL_SCANCODE_KP_6
Definition: SDL_scancode.h:193
@ SDL_SCANCODE_7
Definition: SDL_scancode.h:87
@ SDL_SCANCODE_9
Definition: SDL_scancode.h:89
@ SDL_SCANCODE_KP_7
Definition: SDL_scancode.h:194
@ SDL_SCANCODE_KP_9
Definition: SDL_scancode.h:196
@ SDL_SCANCODE_VOLUMEUP
Definition: SDL_scancode.h:239
@ SDL_SCANCODE_NUMLOCKCLEAR
Definition: SDL_scancode.h:181
@ SDL_SCANCODE_PRINTSCREEN
Definition: SDL_scancode.h:166
@ SDL_SCANCODE_POWER
Definition: SDL_scancode.h:211
@ SDL_SCANCODE_KP_3
Definition: SDL_scancode.h:190
@ SDL_SCANCODE_SCROLLLOCK
Definition: SDL_scancode.h:167
@ SDL_SCANCODE_PAUSE
Definition: SDL_scancode.h:168
@ SDL_SCANCODE_RETURN
Definition: SDL_scancode.h:92
@ SDL_SCANCODE_PAGEDOWN
Definition: SDL_scancode.h:175
@ SDL_SCANCODE_INTERNATIONAL3
Definition: SDL_scancode.h:251
@ SDL_SCANCODE_LSHIFT
Definition: SDL_scancode.h:329
@ SDL_SCANCODE_TAB
Definition: SDL_scancode.h:95
@ SDL_SCANCODE_LANG1
Definition: SDL_scancode.h:258
@ SDL_SCANCODE_3
Definition: SDL_scancode.h:83
@ SDL_SCANCODE_LCTRL
Definition: SDL_scancode.h:328
@ SDL_SCANCODE_SEMICOLON
Definition: SDL_scancode.h:128
@ SDL_SCANCODE_F16
Definition: SDL_scancode.h:218
@ SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
@ SDL_SCANCODE_LGUI
Definition: SDL_scancode.h:331
@ SDL_SCANCODE_0
Definition: SDL_scancode.h:90
@ SDL_SCANCODE_LEFTBRACKET
Definition: SDL_scancode.h:100
@ SDL_SCANCODE_F19
Definition: SDL_scancode.h:221
@ SDL_SCANCODE_V
Definition: SDL_scancode.h:75
@ SDL_SCANCODE_GRAVE
Definition: SDL_scancode.h:130
@ SDL_SCANCODE_RALT
Definition: SDL_scancode.h:334
@ SDL_SCANCODE_MUTE
Definition: SDL_scancode.h:238
@ SDL_SCANCODE_8
Definition: SDL_scancode.h:88
@ SDL_SCANCODE_I
Definition: SDL_scancode.h:62
@ SDL_SCANCODE_F17
Definition: SDL_scancode.h:219
@ SDL_SCANCODE_6
Definition: SDL_scancode.h:86
@ SDL_SCANCODE_S
Definition: SDL_scancode.h:72
@ SDL_SCANCODE_KP_ENTER
Definition: SDL_scancode.h:187
@ SDL_SCANCODE_PAGEUP
Definition: SDL_scancode.h:172
@ SDL_SCANCODE_Z
Definition: SDL_scancode.h:79
@ SDL_SCANCODE_P
Definition: SDL_scancode.h:69
@ SDL_SCANCODE_D
Definition: SDL_scancode.h:57
@ SDL_SCANCODE_PERIOD
Definition: SDL_scancode.h:148
@ SDL_SCANCODE_R
Definition: SDL_scancode.h:71
@ SDL_SCANCODE_KP_1
Definition: SDL_scancode.h:188
@ SDL_SCANCODE_DOWN
Definition: SDL_scancode.h:178
@ SDL_SCANCODE_RIGHT
Definition: SDL_scancode.h:176
@ SDL_SCANCODE_F7
Definition: SDL_scancode.h:159
@ SDL_SCANCODE_MINUS
Definition: SDL_scancode.h:98
@ SDL_SCANCODE_A
Definition: SDL_scancode.h:54
@ SDL_SCANCODE_G
Definition: SDL_scancode.h:60
@ SDL_SCANCODE_KP_2
Definition: SDL_scancode.h:189
@ SDL_SCANCODE_U
Definition: SDL_scancode.h:74
@ SDL_SCANCODE_KP_MULTIPLY
Definition: SDL_scancode.h:184
@ SDL_SCANCODE_4
Definition: SDL_scancode.h:84
@ SDL_SCANCODE_F9
Definition: SDL_scancode.h:161
@ SDL_SCANCODE_F5
Definition: SDL_scancode.h:157
@ SDL_SCANCODE_UP
Definition: SDL_scancode.h:179
@ SDL_SCANCODE_LEFT
Definition: SDL_scancode.h:177
@ SDL_SCANCODE_APPLICATION
Definition: SDL_scancode.h:210
@ SDL_SCANCODE_KP_4
Definition: SDL_scancode.h:191
@ SDL_SCANCODE_C
Definition: SDL_scancode.h:56
@ SDL_SCANCODE_HOME
Definition: SDL_scancode.h:171
@ SDL_SCANCODE_T
Definition: SDL_scancode.h:73
@ SDL_SCANCODE_F8
Definition: SDL_scancode.h:160
@ SDL_SCANCODE_LALT
Definition: SDL_scancode.h:330
@ SDL_SCANCODE_KP_8
Definition: SDL_scancode.h:195
@ SDL_SCANCODE_RCTRL
Definition: SDL_scancode.h:332
@ SDL_SCANCODE_KP_5
Definition: SDL_scancode.h:192
@ SDL_SCANCODE_L
Definition: SDL_scancode.h:65
@ SDL_SCANCODE_VOLUMEDOWN
Definition: SDL_scancode.h:240
@ SDL_SCANCODE_KP_DIVIDE
Definition: SDL_scancode.h:183
@ SDL_SCANCODE_F18
Definition: SDL_scancode.h:220
@ SDL_SCANCODE_N
Definition: SDL_scancode.h:67
@ SDL_SCANCODE_BACKSPACE
Definition: SDL_scancode.h:94
@ SDL_SCANCODE_EQUALS
Definition: SDL_scancode.h:99
@ SDL_SCANCODE_SPACE
Definition: SDL_scancode.h:96
@ SDL_SCANCODE_RSHIFT
Definition: SDL_scancode.h:333
@ SDL_SCANCODE_INSERT
Definition: SDL_scancode.h:169
@ SDL_SCANCODE_J
Definition: SDL_scancode.h:63
@ SDL_SCANCODE_1
Definition: SDL_scancode.h:81
@ SDL_SCANCODE_Q
Definition: SDL_scancode.h:70
static const SDL_Scancode darwin_scancode_table[]