Ticket #8696: Keycodes.diff
File Keycodes.diff, 6.5 KB (added by , 17 years ago) |
---|
-
backends/events/default/default-events.cpp
106 106 event.type = Common::EVENT_KEYDOWN; 107 107 event.synthetic = true; 108 108 event.kbd.ascii = _currentKeyDown.ascii; 109 event.kbd.keycode = _currentKeyDown.keycode;109 event.kbd.keycode = (Common::KeyCode)_currentKeyDown.keycode; 110 110 event.kbd.flags = _currentKeyDown.flags; 111 111 _keyRepeatTime = time + kKeyRepeatSustainDelay; 112 112 result = true; -
backends/platform/sdl/events.cpp
265 265 return true; 266 266 267 267 event.type = Common::EVENT_KEYDOWN; 268 event.kbd.keycode = ev.key.keysym.sym;268 event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym; 269 269 event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); 270 270 271 271 return true; … … 278 278 return true; 279 279 280 280 event.type = Common::EVENT_KEYUP; 281 event.kbd.keycode = ev.key.keysym.sym;281 event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym; 282 282 event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); 283 283 b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); 284 284 … … 337 337 event.type = Common::EVENT_KEYDOWN; 338 338 switch (ev.jbutton.button) { 339 339 case JOY_BUT_ESCAPE: 340 event.kbd.keycode = SDLK_ESCAPE;340 event.kbd.keycode = Common::KEY_ESCAPE; 341 341 event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); 342 342 break; 343 343 case JOY_BUT_PERIOD: 344 event.kbd.keycode = SDLK_PERIOD;344 event.kbd.keycode = Common::KEY_PERIOD; 345 345 event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); 346 346 break; 347 347 case JOY_BUT_SPACE: 348 event.kbd.keycode = SDLK_SPACE;348 event.kbd.keycode = Common::KEY_SPACE; 349 349 event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); 350 350 break; 351 351 case JOY_BUT_F5: 352 event.kbd.keycode = SDLK_F5;352 event.kbd.keycode = Common::KEY_F5; 353 353 event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); 354 354 break; 355 355 } … … 367 367 event.type = Common::EVENT_KEYUP; 368 368 switch (ev.jbutton.button) { 369 369 case JOY_BUT_ESCAPE: 370 event.kbd.keycode = SDLK_ESCAPE;370 event.kbd.keycode = Common::KEY_ESCAPE; 371 371 event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); 372 372 break; 373 373 case JOY_BUT_PERIOD: 374 event.kbd.keycode = SDLK_PERIOD;374 event.kbd.keycode = Common::KEY_PERIOD; 375 375 event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); 376 376 break; 377 377 case JOY_BUT_SPACE: 378 event.kbd.keycode = SDLK_SPACE;378 event.kbd.keycode = Common::KEY_SPACE; 379 379 event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); 380 380 break; 381 381 case JOY_BUT_F5: 382 event.kbd.keycode = SDLK_F5;382 event.kbd.keycode = Common::KEY_F5; 383 383 event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); 384 384 break; 385 385 } -
common/events.h
66 66 EVENT_PREDICTIVE_DIALOG = 12 67 67 }; 68 68 69 enum KeyCode { 70 KEY_BACKSPACE = 8, 71 KEY_TAB = 9, 72 KEY_CLEAR = 12, 73 KEY_RETURN = 13, 74 KEY_PAUSE = 19, 75 KEY_ESCAPE = 27, 76 KEY_SPACE = 32, 77 KEY_EXCLAIM = 33, 78 KEY_QUOTEDBL = 34, 79 KEY_HASH = 35, 80 KEY_DOLLAR = 36, 81 KEY_AMPERSAND = 38, 82 KEY_QUOTE = 39, 83 KEY_LEFTPAREN = 40, 84 KEY_RIGHTPAREN = 41, 85 KEY_ASTERISK = 42, 86 KEY_PLUS = 43, 87 KEY_COMMA = 44, 88 KEY_MINUS = 45, 89 KEY_PERIOD = 46, 90 KEY_SLASH = 47, 91 KEY_0 = 48, 92 KEY_1 = 49, 93 KEY_2 = 50, 94 KEY_3 = 51, 95 KEY_4 = 52, 96 KEY_5 = 53, 97 KEY_6 = 54, 98 KEY_7 = 55, 99 KEY_8 = 56, 100 KEY_9 = 57, 101 KEY_COLON = 58, 102 KEY_SEMICOLON = 59, 103 KEY_LESS = 60, 104 KEY_EQUALS = 61, 105 KEY_GREATER = 62, 106 KEY_QUESTION = 63, 107 KEY_AT = 64, 108 109 KEY_LEFTBRACKET = 91, 110 KEY_BACKSLASH = 92, 111 KEY_RIGHTBRACKET = 93, 112 KEY_CARET = 94, 113 KEY_UNDERSCORE = 95, 114 KEY_BACKQUOTE = 96, 115 KEY_a = 97, 116 KEY_b = 98, 117 KEY_c = 99, 118 KEY_d = 100, 119 KEY_e = 101, 120 KEY_f = 102, 121 KEY_g = 103, 122 KEY_h = 104, 123 KEY_i = 105, 124 KEY_j = 106, 125 KEY_k = 107, 126 KEY_l = 108, 127 KEY_m = 109, 128 KEY_n = 110, 129 KEY_o = 111, 130 KEY_p = 112, 131 KEY_q = 113, 132 KEY_r = 114, 133 KEY_s = 115, 134 KEY_t = 116, 135 KEY_u = 117, 136 KEY_v = 118, 137 KEY_w = 119, 138 KEY_x = 120, 139 KEY_y = 121, 140 KEY_z = 122, 141 KEY_DELETE = 127, 142 143 // Numeric keypad 144 KEY_KP0 = 256, 145 KEY_KP1 = 257, 146 KEY_KP2 = 258, 147 KEY_KP3 = 259, 148 KEY_KP4 = 260, 149 KEY_KP5 = 261, 150 KEY_KP6 = 262, 151 KEY_KP7 = 263, 152 KEY_KP8 = 264, 153 KEY_KP9 = 265, 154 KEY_KP_PERIOD = 266, 155 KEY_KP_DIVIDE = 267, 156 KEY_KP_MULTIPLY = 268, 157 KEY_KP_MINUS = 269, 158 KEY_KP_PLUS = 270, 159 KEY_KP_ENTER = 271, 160 KEY_KP_EQUALS = 272, 161 162 // Arrows + Home/End pad 163 KEY_UP = 273, 164 KEY_DOWN = 274, 165 KEY_RIGHT = 275, 166 KEY_LEFT = 276, 167 KEY_INSERT = 277, 168 KEY_HOME = 278, 169 KEY_END = 279, 170 KEY_PAGEUP = 280, 171 KEY_PAGEDOWN = 281, 172 173 // Function keys 174 KEY_F1 = 282, 175 KEY_F2 = 283, 176 KEY_F3 = 284, 177 KEY_F4 = 285, 178 KEY_F5 = 286, 179 KEY_F6 = 287, 180 KEY_F7 = 288, 181 KEY_F8 = 289, 182 KEY_F9 = 290, 183 KEY_F10 = 291, 184 KEY_F11 = 292, 185 KEY_F12 = 293, 186 KEY_F13 = 294, 187 KEY_F14 = 295, 188 KEY_F15 = 296, 189 190 // Key state modifier keys 191 KEY_NUMLOCK = 300, 192 KEY_CAPSLOCK = 301, 193 KEY_SCROLLOCK = 302, 194 KEY_RSHIFT = 303, 195 KEY_LSHIFT = 304, 196 KEY_RCTRL = 305, 197 KEY_LCTRL = 306, 198 KEY_RALT = 307, 199 KEY_LALT = 308, 200 KEY_RMETA = 309, 201 KEY_LMETA = 310, 202 KEY_LSUPER = 311, // Left "Windows" key 203 KEY_RSUPER = 312, // Right "Windows" key 204 KEY_MODE = 313, // "Alt Gr" key 205 KEY_COMPOSE = 314, // Multi-key compose key 206 207 //Miscellaneous function keys 208 KEY_HELP = 315, 209 KEY_PRINT = 316, 210 KEY_SYSREQ = 317, 211 KEY_BREAK = 318, 212 KEY_MENU = 319, 213 KEY_POWER = 320, // Power Macintosh power key 214 KEY_EURO = 321, // Some european keyboards 215 KEY_UNDO = 322 // Atari keyboard has Undo 216 }; 217 69 218 /** 70 219 * Keyboard modifier flags, used for Event::kbd::flags. 71 220 */ … … 125 274 * we fix this, your best bet is to get a copy of SDL_keysym.h 126 275 * and look at that, if you want to find out a key code. 127 276 */ 128 intkeycode;277 KeyCode keycode; 129 278 /** 130 279 * ASCII-value of the pressed key (if any). 131 280 * This depends on modifiers, i.e. pressing the 'A' key results in