zenilib: zenilib/jni/external/sdl/src/events/SDL_keyboard.c Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_keyboard.c
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 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 "SDL_config.h"
22
23 /* General keyboard handling code for SDL */
24
25 #include "SDL_timer.h"
26 #include "SDL_events.h"
27 #include "SDL_events_c.h"
28 #include "../video/SDL_sysvideo.h"
29
30
31 /* #define DEBUG_KEYBOARD */
32
33 /* Global keyboard information */
34
35 typedef struct SDL_Keyboard SDL_Keyboard;
36
37 struct SDL_Keyboard
38 {
39 /* Data common to all keyboards */
40 SDL_Window *focus;
41 Uint16 modstate;
42 Uint8 keystate[SDL_NUM_SCANCODES];
43 SDL_Keycode keymap[SDL_NUM_SCANCODES];
44 };
45
46 static SDL_Keyboard SDL_keyboard;
47
48 static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
49 0, 0, 0, 0,
50 'a',
51 'b',
52 'c',
53 'd',
54 'e',
55 'f',
56 'g',
57 'h',
58 'i',
59 'j',
60 'k',
61 'l',
62 'm',
63 'n',
64 'o',
65 'p',
66 'q',
67 'r',
68 's',
69 't',
70 'u',
71 'v',
72 'w',
73 'x',
74 'y',
75 'z',
76 '1',
77 '2',
78 '3',
79 '4',
80 '5',
81 '6',
82 '7',
83 '8',
84 '9',
85 '0',
86 SDLK_RETURN,
87 SDLK_ESCAPE,
88 SDLK_BACKSPACE,
89 SDLK_TAB,
90 SDLK_SPACE,
91 '-',
92 '=',
93 '[',
94 ']',
95 '\\',
96 '#',
97 ';',
98 '\'',
99 '`',
100 ',',
101 '.',
102 '/',
103 SDLK_CAPSLOCK,
104 SDLK_F1,
105 SDLK_F2,
106 SDLK_F3,
107 SDLK_F4,
108 SDLK_F5,
109 SDLK_F6,
110 SDLK_F7,
111 SDLK_F8,
112 SDLK_F9,
113 SDLK_F10,
114 SDLK_F11,
115 SDLK_F12,
116 SDLK_PRINTSCREEN,
117 SDLK_SCROLLLOCK,
118 SDLK_PAUSE,
119 SDLK_INSERT,
120 SDLK_HOME,
121 SDLK_PAGEUP,
122 SDLK_DELETE,
123 SDLK_END,
124 SDLK_PAGEDOWN,
125 SDLK_RIGHT,
126 SDLK_LEFT,
127 SDLK_DOWN,
128 SDLK_UP,
129 SDLK_NUMLOCKCLEAR,
130 SDLK_KP_DIVIDE,
131 SDLK_KP_MULTIPLY,
132 SDLK_KP_MINUS,
133 SDLK_KP_PLUS,
134 SDLK_KP_ENTER,
135 SDLK_KP_1,
136 SDLK_KP_2,
137 SDLK_KP_3,
138 SDLK_KP_4,
139 SDLK_KP_5,
140 SDLK_KP_6,
141 SDLK_KP_7,
142 SDLK_KP_8,
143 SDLK_KP_9,
144 SDLK_KP_0,
145 SDLK_KP_PERIOD,
146 0,
147 SDLK_APPLICATION,
148 SDLK_POWER,
149 SDLK_KP_EQUALS,
150 SDLK_F13,
151 SDLK_F14,
152 SDLK_F15,
153 SDLK_F16,
154 SDLK_F17,
155 SDLK_F18,
156 SDLK_F19,
157 SDLK_F20,
158 SDLK_F21,
159 SDLK_F22,
160 SDLK_F23,
161 SDLK_F24,
162 SDLK_EXECUTE,
163 SDLK_HELP,
164 SDLK_MENU,
165 SDLK_SELECT,
166 SDLK_STOP,
167 SDLK_AGAIN,
168 SDLK_UNDO,
169 SDLK_CUT,
170 SDLK_COPY,
171 SDLK_PASTE,
172 SDLK_FIND,
173 SDLK_MUTE,
174 SDLK_VOLUMEUP,
175 SDLK_VOLUMEDOWN,
176 0, 0, 0,
177 SDLK_KP_COMMA,
178 SDLK_KP_EQUALSAS400,
179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
180 SDLK_ALTERASE,
181 SDLK_SYSREQ,
182 SDLK_CANCEL,
183 SDLK_CLEAR,
184 SDLK_PRIOR,
185 SDLK_RETURN2,
186 SDLK_SEPARATOR,
187 SDLK_OUT,
188 SDLK_OPER,
189 SDLK_CLEARAGAIN,
190 SDLK_CRSEL,
191 SDLK_EXSEL,
192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
193 SDLK_KP_00,
194 SDLK_KP_000,
195 SDLK_THOUSANDSSEPARATOR,
196 SDLK_DECIMALSEPARATOR,
197 SDLK_CURRENCYUNIT,
198 SDLK_CURRENCYSUBUNIT,
199 SDLK_KP_LEFTPAREN,
200 SDLK_KP_RIGHTPAREN,
201 SDLK_KP_LEFTBRACE,
202 SDLK_KP_RIGHTBRACE,
203 SDLK_KP_TAB,
204 SDLK_KP_BACKSPACE,
205 SDLK_KP_A,
206 SDLK_KP_B,
207 SDLK_KP_C,
208 SDLK_KP_D,
209 SDLK_KP_E,
210 SDLK_KP_F,
211 SDLK_KP_XOR,
212 SDLK_KP_POWER,
213 SDLK_KP_PERCENT,
214 SDLK_KP_LESS,
215 SDLK_KP_GREATER,
216 SDLK_KP_AMPERSAND,
217 SDLK_KP_DBLAMPERSAND,
218 SDLK_KP_VERTICALBAR,
219 SDLK_KP_DBLVERTICALBAR,
220 SDLK_KP_COLON,
221 SDLK_KP_HASH,
222 SDLK_KP_SPACE,
223 SDLK_KP_AT,
224 SDLK_KP_EXCLAM,
225 SDLK_KP_MEMSTORE,
226 SDLK_KP_MEMRECALL,
227 SDLK_KP_MEMCLEAR,
228 SDLK_KP_MEMADD,
229 SDLK_KP_MEMSUBTRACT,
230 SDLK_KP_MEMMULTIPLY,
231 SDLK_KP_MEMDIVIDE,
232 SDLK_KP_PLUSMINUS,
233 SDLK_KP_CLEAR,
234 SDLK_KP_CLEARENTRY,
235 SDLK_KP_BINARY,
236 SDLK_KP_OCTAL,
237 SDLK_KP_DECIMAL,
238 SDLK_KP_HEXADECIMAL,
239 0, 0,
240 SDLK_LCTRL,
241 SDLK_LSHIFT,
242 SDLK_LALT,
243 SDLK_LGUI,
244 SDLK_RCTRL,
245 SDLK_RSHIFT,
246 SDLK_RALT,
247 SDLK_RGUI,
248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
249 SDLK_MODE,
250 SDLK_AUDIONEXT,
251 SDLK_AUDIOPREV,
252 SDLK_AUDIOSTOP,
253 SDLK_AUDIOPLAY,
254 SDLK_AUDIOMUTE,
255 SDLK_MEDIASELECT,
256 SDLK_WWW,
257 SDLK_MAIL,
258 SDLK_CALCULATOR,
259 SDLK_COMPUTER,
260 SDLK_AC_SEARCH,
261 SDLK_AC_HOME,
262 SDLK_AC_BACK,
263 SDLK_AC_FORWARD,
264 SDLK_AC_STOP,
265 SDLK_AC_REFRESH,
266 SDLK_AC_BOOKMARKS,
267 SDLK_BRIGHTNESSDOWN,
268 SDLK_BRIGHTNESSUP,
269 SDLK_DISPLAYSWITCH,
270 SDLK_KBDILLUMTOGGLE,
271 SDLK_KBDILLUMDOWN,
272 SDLK_KBDILLUMUP,
273 SDLK_EJECT,
274 SDLK_SLEEP,
275 };
276
277 static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
278 NULL, NULL, NULL, NULL,
279 "A",
280 "B",
281 "C",
282 "D",
283 "E",
284 "F",
285 "G",
286 "H",
287 "I",
288 "J",
289 "K",
290 "L",
291 "M",
292 "N",
293 "O",
294 "P",
295 "Q",
296 "R",
297 "S",
298 "T",
299 "U",
300 "V",
301 "W",
302 "X",
303 "Y",
304 "Z",
305 "1",
306 "2",
307 "3",
308 "4",
309 "5",
310 "6",
311 "7",
312 "8",
313 "9",
314 "0",
315 "Return",
316 "Escape",
317 "Backspace",
318 "Tab",
319 "Space",
320 "-",
321 "=",
322 "[",
323 "]",
324 "\\",
325 "#",
326 ";",
327 "'",
328 "`",
329 ",",
330 ".",
331 "/",
332 "CapsLock",
333 "F1",
334 "F2",
335 "F3",
336 "F4",
337 "F5",
338 "F6",
339 "F7",
340 "F8",
341 "F9",
342 "F10",
343 "F11",
344 "F12",
345 "PrintScreen",
346 "ScrollLock",
347 "Pause",
348 "Insert",
349 "Home",
350 "PageUp",
351 "Delete",
352 "End",
353 "PageDown",
354 "Right",
355 "Left",
356 "Down",
357 "Up",
358 "Numlock",
359 "Keypad /",
360 "Keypad *",
361 "Keypad -",
362 "Keypad +",
363 "Keypad Enter",
364 "Keypad 1",
365 "Keypad 2",
366 "Keypad 3",
367 "Keypad 4",
368 "Keypad 5",
369 "Keypad 6",
370 "Keypad 7",
371 "Keypad 8",
372 "Keypad 9",
373 "Keypad 0",
374 "Keypad .",
375 NULL,
376 "Application",
377 "Power",
378 "Keypad =",
379 "F13",
380 "F14",
381 "F15",
382 "F16",
383 "F17",
384 "F18",
385 "F19",
386 "F20",
387 "F21",
388 "F22",
389 "F23",
390 "F24",
391 "Execute",
392 "Help",
393 "Menu",
394 "Select",
395 "Stop",
396 "Again",
397 "Undo",
398 "Cut",
399 "Copy",
400 "Paste",
401 "Find",
402 "Mute",
403 "VolumeUp",
404 "VolumeDown",
405 NULL, NULL, NULL,
406 "Keypad ,",
407 "Keypad = (AS400)",
408 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
409 NULL, NULL, NULL, NULL, NULL, NULL,
410 "AltErase",
411 "SysReq",
412 "Cancel",
413 "Clear",
414 "Prior",
415 "Return",
416 "Separator",
417 "Out",
418 "Oper",
419 "Clear / Again",
420 "CrSel",
421 "ExSel",
422 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
423 "Keypad 00",
424 "Keypad 000",
425 "ThousandsSeparator",
426 "DecimalSeparator",
427 "CurrencyUnit",
428 "CurrencySubUnit",
429 "Keypad (",
430 "Keypad )",
431 "Keypad {",
432 "Keypad }",
433 "Keypad Tab",
434 "Keypad Backspace",
435 "Keypad A",
436 "Keypad B",
437 "Keypad C",
438 "Keypad D",
439 "Keypad E",
440 "Keypad F",
441 "Keypad XOR",
442 "Keypad ^",
443 "Keypad %",
444 "Keypad <",
445 "Keypad >",
446 "Keypad &",
447 "Keypad &&",
448 "Keypad |",
449 "Keypad ||",
450 "Keypad :",
451 "Keypad #",
452 "Keypad Space",
453 "Keypad @",
454 "Keypad !",
455 "Keypad MemStore",
456 "Keypad MemRecall",
457 "Keypad MemClear",
458 "Keypad MemAdd",
459 "Keypad MemSubtract",
460 "Keypad MemMultiply",
461 "Keypad MemDivide",
462 "Keypad +/-",
463 "Keypad Clear",
464 "Keypad ClearEntry",
465 "Keypad Binary",
466 "Keypad Octal",
467 "Keypad Decimal",
468 "Keypad Hexadecimal",
469 NULL, NULL,
470 "Left Ctrl",
471 "Left Shift",
472 "Left Alt",
473 "Left GUI",
474 "Right Ctrl",
475 "Right Shift",
476 "Right Alt",
477 "Right GUI",
478 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
479 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
480 NULL,
481 "ModeSwitch",
482 "AudioNext",
483 "AudioPrev",
484 "AudioStop",
485 "AudioPlay",
486 "AudioMute",
487 "MediaSelect",
488 "WWW",
489 "Mail",
490 "Calculator",
491 "Computer",
492 "AC Search",
493 "AC Home",
494 "AC Back",
495 "AC Forward",
496 "AC Stop",
497 "AC Refresh",
498 "AC Bookmarks",
499 "BrightnessDown",
500 "BrightnessUp",
501 "DisplaySwitch",
502 "KBDIllumToggle",
503 "KBDIllumDown",
504 "KBDIllumUp",
505 "Eject",
506 "Sleep",
507 };
508
509 /* Taken from SDL_iconv() */
510 static char *
511 SDL_UCS4ToUTF8(Uint32 ch, char *dst)
512 {
513 Uint8 *p = (Uint8 *) dst;
514 if (ch <= 0x7F) {
515 *p = (Uint8) ch;
516 ++dst;
517 } else if (ch <= 0x7FF) {
518 p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
519 p[1] = 0x80 | (Uint8) (ch & 0x3F);
520 dst += 2;
521 } else if (ch <= 0xFFFF) {
522 p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
523 p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
524 p[2] = 0x80 | (Uint8) (ch & 0x3F);
525 dst += 3;
526 } else if (ch <= 0x1FFFFF) {
527 p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
528 p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
529 p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
530 p[3] = 0x80 | (Uint8) (ch & 0x3F);
531 dst += 4;
532 } else if (ch <= 0x3FFFFFF) {
533 p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
534 p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
535 p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
536 p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
537 p[4] = 0x80 | (Uint8) (ch & 0x3F);
538 dst += 5;
539 } else {
540 p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
541 p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
542 p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
543 p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
544 p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
545 p[5] = 0x80 | (Uint8) (ch & 0x3F);
546 dst += 6;
547 }
548 return dst;
549 }
550
551 /* Public functions */
552 int
553 SDL_KeyboardInit(void)
554 {
555 SDL_Keyboard *keyboard = &SDL_keyboard;
556
557 /* Set the default keymap */
558 SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
559 return (0);
560 }
561
562 void
563 SDL_ResetKeyboard(void)
564 {
565 SDL_Keyboard *keyboard = &SDL_keyboard;
566 SDL_Scancode scancode;
567
568 #ifdef DEBUG_KEYBOARD
569 printf("Resetting keyboard\n");
570 #endif
571 for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
572 if (keyboard->keystate[scancode] == SDL_PRESSED) {
573 SDL_SendKeyboardKey(SDL_RELEASED, scancode);
574 }
575 }
576 }
577
578 void
579 SDL_GetDefaultKeymap(SDL_Keycode * keymap)
580 {
581 SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
582 }
583
584 void
585 SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
586 {
587 SDL_Keyboard *keyboard = &SDL_keyboard;
588
589 if (start < 0 || start + length > SDL_NUM_SCANCODES) {
590 return;
591 }
592
593 SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length);
594 }
595
596 void
597 SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
598 {
599 SDL_scancode_names[scancode] = name;
600 }
601
602 SDL_Window *
603 SDL_GetKeyboardFocus(void)
604 {
605 SDL_Keyboard *keyboard = &SDL_keyboard;
606
607 return keyboard->focus;
608 }
609
610 void
611 SDL_SetKeyboardFocus(SDL_Window * window)
612 {
613 SDL_Keyboard *keyboard = &SDL_keyboard;
614
615 if (keyboard->focus && !window) {
616 /* We won't get anymore keyboard messages, so reset keyboard state */
617 SDL_ResetKeyboard();
618 }
619
620 /* See if the current window has lost focus */
621 if (keyboard->focus && keyboard->focus != window) {
622 SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
623 0, 0);
624
625 /* Ensures IME compositions are committed */
626 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
627 SDL_VideoDevice *video = SDL_GetVideoDevice();
628 if (video && video->StopTextInput) {
629 video->StopTextInput(video);
630 }
631 }
632 }
633
634 keyboard->focus = window;
635
636 if (keyboard->focus) {
637 SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
638 0, 0);
639
640 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
641 SDL_VideoDevice *video = SDL_GetVideoDevice();
642 if (video && video->StartTextInput) {
643 video->StartTextInput(video);
644 }
645 }
646 }
647 }
648
649 int
650 SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
651 {
652 SDL_Keyboard *keyboard = &SDL_keyboard;
653 int posted;
654 Uint16 modstate;
655 Uint32 type;
656 Uint8 repeat;
657
658 if (!scancode) {
659 return 0;
660 }
661 #ifdef DEBUG_KEYBOARD
662 printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
663 state == SDL_PRESSED ? "pressed" : "released");
664 #endif
665 if (state == SDL_PRESSED) {
666 modstate = keyboard->modstate;
667 switch (scancode) {
668 case SDL_SCANCODE_NUMLOCKCLEAR:
669 keyboard->modstate ^= KMOD_NUM;
670 break;
671 case SDL_SCANCODE_CAPSLOCK:
672 keyboard->modstate ^= KMOD_CAPS;
673 break;
674 case SDL_SCANCODE_LCTRL:
675 keyboard->modstate |= KMOD_LCTRL;
676 break;
677 case SDL_SCANCODE_RCTRL:
678 keyboard->modstate |= KMOD_RCTRL;
679 break;
680 case SDL_SCANCODE_LSHIFT:
681 keyboard->modstate |= KMOD_LSHIFT;
682 break;
683 case SDL_SCANCODE_RSHIFT:
684 keyboard->modstate |= KMOD_RSHIFT;
685 break;
686 case SDL_SCANCODE_LALT:
687 keyboard->modstate |= KMOD_LALT;
688 break;
689 case SDL_SCANCODE_RALT:
690 keyboard->modstate |= KMOD_RALT;
691 break;
692 case SDL_SCANCODE_LGUI:
693 keyboard->modstate |= KMOD_LGUI;
694 break;
695 case SDL_SCANCODE_RGUI:
696 keyboard->modstate |= KMOD_RGUI;
697 break;
698 case SDL_SCANCODE_MODE:
699 keyboard->modstate |= KMOD_MODE;
700 break;
701 default:
702 break;
703 }
704 } else {
705 switch (scancode) {
706 case SDL_SCANCODE_NUMLOCKCLEAR:
707 case SDL_SCANCODE_CAPSLOCK:
708 break;
709 case SDL_SCANCODE_LCTRL:
710 keyboard->modstate &= ~KMOD_LCTRL;
711 break;
712 case SDL_SCANCODE_RCTRL:
713 keyboard->modstate &= ~KMOD_RCTRL;
714 break;
715 case SDL_SCANCODE_LSHIFT:
716 keyboard->modstate &= ~KMOD_LSHIFT;
717 break;
718 case SDL_SCANCODE_RSHIFT:
719 keyboard->modstate &= ~KMOD_RSHIFT;
720 break;
721 case SDL_SCANCODE_LALT:
722 keyboard->modstate &= ~KMOD_LALT;
723 break;
724 case SDL_SCANCODE_RALT:
725 keyboard->modstate &= ~KMOD_RALT;
726 break;
727 case SDL_SCANCODE_LGUI:
728 keyboard->modstate &= ~KMOD_LGUI;
729 break;
730 case SDL_SCANCODE_RGUI:
731 keyboard->modstate &= ~KMOD_RGUI;
732 break;
733 case SDL_SCANCODE_MODE:
734 keyboard->modstate &= ~KMOD_MODE;
735 break;
736 default:
737 break;
738 }
739 modstate = keyboard->modstate;
740 }
741
742 /* Figure out what type of event this is */
743 switch (state) {
744 case SDL_PRESSED:
745 type = SDL_KEYDOWN;
746 break;
747 case SDL_RELEASED:
748 type = SDL_KEYUP;
749 break;
750 default:
751 /* Invalid state -- bail */
752 return 0;
753 }
754
755 /* Drop events that don't change state */
756 repeat = (state && keyboard->keystate[scancode]);
757 if (keyboard->keystate[scancode] == state && !repeat) {
758 #if 0
759 printf("Keyboard event didn't change state - dropped!\n");
760 #endif
761 return 0;
762 }
763
764 /* Update internal keyboard state */
765 keyboard->keystate[scancode] = state;
766
767 /* Post the event, if desired */
768 posted = 0;
769 if (SDL_GetEventState(type) == SDL_ENABLE) {
770 SDL_Event event;
771 event.key.type = type;
772 event.key.state = state;
773 event.key.repeat = repeat;
774 event.key.keysym.scancode = scancode;
775 event.key.keysym.sym = keyboard->keymap[scancode];
776 event.key.keysym.mod = modstate;
777 event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
778 posted = (SDL_PushEvent(&event) > 0);
779 }
780 return (posted);
781 }
782
783 int
784 SDL_SendKeyboardText(const char *text)
785 {
786 SDL_Keyboard *keyboard = &SDL_keyboard;
787 int posted;
788
789 /* Don't post text events for unprintable characters */
790 if ((unsigned char)*text < ' ' || *text == 127) {
791 return 0;
792 }
793
794 /* Post the event, if desired */
795 posted = 0;
796 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
797 SDL_Event event;
798 event.text.type = SDL_TEXTINPUT;
799 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
800 SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
801 posted = (SDL_PushEvent(&event) > 0);
802 }
803 return (posted);
804 }
805
806 int
807 SDL_SendEditingText(const char *text, int start, int length)
808 {
809 SDL_Keyboard *keyboard = &SDL_keyboard;
810 int posted;
811
812 /* Post the event, if desired */
813 posted = 0;
814 if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
815 SDL_Event event;
816 event.edit.type = SDL_TEXTEDITING;
817 event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
818 event.edit.start = start;
819 event.edit.length = length;
820 SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
821 posted = (SDL_PushEvent(&event) > 0);
822 }
823 return (posted);
824 }
825
826 void
827 SDL_KeyboardQuit(void)
828 {
829 }
830
831 const Uint8 *
832 SDL_GetKeyboardState(int *numkeys)
833 {
834 SDL_Keyboard *keyboard = &SDL_keyboard;
835
836 if (numkeys != (int *) 0) {
837 *numkeys = SDL_NUM_SCANCODES;
838 }
839 return keyboard->keystate;
840 }
841
842 SDL_Keymod
843 SDL_GetModState(void)
844 {
845 SDL_Keyboard *keyboard = &SDL_keyboard;
846
847 return keyboard->modstate;
848 }
849
850 void
851 SDL_SetModState(SDL_Keymod modstate)
852 {
853 SDL_Keyboard *keyboard = &SDL_keyboard;
854
855 keyboard->modstate = modstate;
856 }
857
858 SDL_Keycode
859 SDL_GetKeyFromScancode(SDL_Scancode scancode)
860 {
861 SDL_Keyboard *keyboard = &SDL_keyboard;
862
863 if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
864 SDL_InvalidParamError("scancode");
865 return 0;
866 }
867
868 return keyboard->keymap[scancode];
869 }
870
871 SDL_Scancode
872 SDL_GetScancodeFromKey(SDL_Keycode key)
873 {
874 SDL_Keyboard *keyboard = &SDL_keyboard;
875 SDL_Scancode scancode;
876
877 for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
878 ++scancode) {
879 if (keyboard->keymap[scancode] == key) {
880 return scancode;
881 }
882 }
883 return SDL_SCANCODE_UNKNOWN;
884 }
885
886 const char *
887 SDL_GetScancodeName(SDL_Scancode scancode)
888 {
889 const char *name;
890 if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
891 SDL_InvalidParamError("scancode");
892 return "";
893 }
894
895 name = SDL_scancode_names[scancode];
896 if (name)
897 return name;
898 else
899 return "";
900 }
901
902 SDL_Scancode SDL_GetScancodeFromName(const char *name)
903 {
904 int i;
905
906 if (!name || !*name) {
907 SDL_InvalidParamError("name");
908 return SDL_SCANCODE_UNKNOWN;
909 }
910
911 for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
912 if (!SDL_scancode_names[i]) {
913 continue;
914 }
915 if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
916 return (SDL_Scancode)i;
917 }
918 }
919
920 SDL_InvalidParamError("name");
921 return SDL_SCANCODE_UNKNOWN;
922 }
923
924 const char *
925 SDL_GetKeyName(SDL_Keycode key)
926 {
927 static char name[8];
928 char *end;
929
930 if (key & SDLK_SCANCODE_MASK) {
931 return
932 SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
933 }
934
935 switch (key) {
936 case SDLK_RETURN:
937 return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
938 case SDLK_ESCAPE:
939 return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
940 case SDLK_BACKSPACE:
941 return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
942 case SDLK_TAB:
943 return SDL_GetScancodeName(SDL_SCANCODE_TAB);
944 case SDLK_SPACE:
945 return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
946 case SDLK_DELETE:
947 return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
948 default:
949 /* Unaccented letter keys on latin keyboards are normally
950 labeled in upper case (and probably on others like Greek or
951 Cyrillic too, so if you happen to know for sure, please
952 adapt this). */
953 if (key >= 'a' && key <= 'z') {
954 key -= 32;
955 }
956
957 end = SDL_UCS4ToUTF8((Uint32) key, name);
958 *end = '\0';
959 return name;
960 }
961 }
962
963 SDL_Keycode
964 SDL_GetKeyFromName(const char *name)
965 {
966 SDL_Keycode key;
967
968 /* Check input */
969 if (name == NULL) return SDLK_UNKNOWN;
970
971 /* If it's a single UTF-8 character, then that's the keycode itself */
972 key = *(const unsigned char *)name;
973 if (key >= 0xF0) {
974 if (SDL_strlen(name) == 4) {
975 int i = 0;
976 key = (Uint16)(name[i]&0x07) << 18;
977 key |= (Uint16)(name[++i]&0x3F) << 12;
978 key |= (Uint16)(name[++i]&0x3F) << 6;
979 key |= (Uint16)(name[++i]&0x3F);
980 return key;
981 }
982 return SDLK_UNKNOWN;
983 } else if (key >= 0xE0) {
984 if (SDL_strlen(name) == 3) {
985 int i = 0;
986 key = (Uint16)(name[i]&0x0F) << 12;
987 key |= (Uint16)(name[++i]&0x3F) << 6;
988 key |= (Uint16)(name[++i]&0x3F);
989 return key;
990 }
991 return SDLK_UNKNOWN;
992 } else if (key >= 0xC0) {
993 if (SDL_strlen(name) == 2) {
994 int i = 0;
995 key = (Uint16)(name[i]&0x1F) << 6;
996 key |= (Uint16)(name[++i]&0x3F);
997 return key;
998 }
999 return SDLK_UNKNOWN;
1000 } else {
1001 if (SDL_strlen(name) == 1) {
1002 if (key >= 'A' && key <= 'Z') {
1003 key += 32;
1004 }
1005 return key;
1006 }
1007
1008 /* Get the scancode for this name, and the associated keycode */
1009 return SDL_default_keymap[SDL_GetScancodeFromName(name)];
1010 }
1011 }
1012
1013 /* vi: set ts=4 sw=4 expandtab: */
SDLK_F13
Definition: SDL_keycode.h:174
SDLK_EJECT
Definition: SDL_keycode.h:310
SDLK_KP_MEMADD
Definition: SDL_keycode.h:258
SDLK_KP_D
Definition: SDL_keycode.h:235
SDL_GetDefaultKeymap
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
Definition: SDL_keyboard.c:579
SDLK_KBDILLUMDOWN
Definition: SDL_keycode.h:308
SDLK_SELECT
Definition: SDL_keycode.h:189
SDL_SCANCODE_RETURN
Definition: SDL_scancode.h:92
SDLK_KP_EQUALS
Definition: SDL_keycode.h:173
SDLK_KP_MULTIPLY
Definition: SDL_keycode.h:155
SDLK_F18
Definition: SDL_keycode.h:179
SDLK_AUDIOSTOP
Definition: SDL_keycode.h:286
SDLK_F3
Definition: SDL_keycode.h:128
SDL_KEYDOWN
Definition: SDL_events.h:93
SDL_PushEvent
DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
Definition: SDL_events.c:457
SDL_GetKeyName
DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
Definition: SDL_keyboard.c:925
KMOD_LCTRL
Definition: SDL_keycode.h:322
SDLK_F15
Definition: SDL_keycode.h:176
SDLK_KP_MEMSUBTRACT
Definition: SDL_keycode.h:259
SDLK_KP_EXCLAM
Definition: SDL_keycode.h:254
SDLK_KP_00
Definition: SDL_keycode.h:217
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:611
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
SDLK_DECIMALSEPARATOR
Definition: SDL_keycode.h:221
SDLK_RCTRL
Definition: SDL_keycode.h:277
SDLK_F8
Definition: SDL_keycode.h:133
SDLK_F21
Definition: SDL_keycode.h:182
SDLK_F9
Definition: SDL_keycode.h:134
SDLK_LSHIFT
Definition: SDL_keycode.h:274
SDLK_PASTE
Definition: SDL_keycode.h:195
NULL
#define NULL
Definition: ftobjs.h:61
SDLK_SLEEP
Definition: SDL_keycode.h:311
SDLK_SYSREQ
Definition: SDL_keycode.h:205
start
GLuint start
Definition: glew.h:1239
SDLK_AUDIOPREV
Definition: SDL_keycode.h:285
SDLK_KP_PERCENT
Definition: SDL_keycode.h:240
SDLK_KP_HASH
Definition: SDL_keycode.h:251
SDLK_AUDIOPLAY
Definition: SDL_keycode.h:287
SDLK_UNDO
Definition: SDL_keycode.h:192
SDLK_KP_LEFTBRACE
Definition: SDL_keycode.h:228
SDLK_DELETE
Definition: SDL_keycode.h:145
KMOD_RCTRL
Definition: SDL_keycode.h:323
SDLK_VOLUMEDOWN
Definition: SDL_keycode.h:199
SDLK_KP_MEMCLEAR
Definition: SDL_keycode.h:257
KMOD_LSHIFT
Definition: SDL_keycode.h:320
SDLK_F2
Definition: SDL_keycode.h:127
SDL_GetScancodeFromName
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
Definition: SDL_keyboard.c:902
SDLK_BACKSPACE
Definition: SDL_keycode.h:53
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:244
SDL_Keyboard
struct SDL_Keyboard SDL_Keyboard
Definition: SDL_keyboard.c:35
SDLK_CANCEL
Definition: SDL_keycode.h:206
SDL_events.h
SDLK_KP_BACKSPACE
Definition: SDL_keycode.h:231
SDLK_AC_FORWARD
Definition: SDL_keycode.h:297
SDLK_AC_BOOKMARKS
Definition: SDL_keycode.h:300
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:688
SDLK_KP_RIGHTBRACE
Definition: SDL_keycode.h:229
SDLK_SCANCODE_MASK
#define SDLK_SCANCODE_MASK
Definition: SDL_keycode.h:44
SDLK_KP_LESS
Definition: SDL_keycode.h:241
SDLK_HELP
Definition: SDL_keycode.h:187
SDLK_AGAIN
Definition: SDL_keycode.h:191
SDL_GetKeyboardState
DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
Definition: SDL_keyboard.c:832
SDLK_F1
Definition: SDL_keycode.h:126
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
SDL_EventState
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
Definition: SDL_events.c:555
SDL_utf8strlcpy
DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes)
Definition: SDL_string.c:463
SDLK_EXSEL
Definition: SDL_keycode.h:215
SDLK_KP_PLUS
Definition: SDL_keycode.h:157
SDLK_KP_BINARY
Definition: SDL_keycode.h:267
SDLK_KP_EQUALSAS400
Definition: SDL_keycode.h:201
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDLK_CUT
Definition: SDL_keycode.h:193
SDL_KeyboardInit
int SDL_KeyboardInit(void)
Definition: SDL_keyboard.c:553
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDLK_CLEARAGAIN
Definition: SDL_keycode.h:213
SDLK_F24
Definition: SDL_keycode.h:185
SDLK_KP_DBLAMPERSAND
Definition: SDL_keycode.h:244
SDLK_F16
Definition: SDL_keycode.h:177
SDLK_KP_COLON
Definition: SDL_keycode.h:250
SDLK_F6
Definition: SDL_keycode.h:131
SDLK_F23
Definition: SDL_keycode.h:184
SDLK_KP_DBLVERTICALBAR
Definition: SDL_keycode.h:248
SDLK_KP_SPACE
Definition: SDL_keycode.h:252
SDL_Keycode
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:42
SDLK_KP_AMPERSAND
Definition: SDL_keycode.h:243
SDLK_F17
Definition: SDL_keycode.h:178
SDL_SCANCODE_TAB
Definition: SDL_scancode.h:95
SDL_SCANCODE_CAPSLOCK
Definition: SDL_scancode.h:151
SDL_config.h
SDLK_LEFT
Definition: SDL_keycode.h:149
SDL_SCANCODE_LALT
Definition: SDL_scancode.h:330
SDL_SendKeyboardKey
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
Definition: SDL_keyboard.c:650
SDLK_COMPUTER
Definition: SDL_keycode.h:293
SDLK_CAPSLOCK
Definition: SDL_keycode.h:124
SDLK_CRSEL
Definition: SDL_keycode.h:214
SDLK_KP_OCTAL
Definition: SDL_keycode.h:268
SDLK_PRIOR
Definition: SDL_keycode.h:208
SDLK_VOLUMEUP
Definition: SDL_keycode.h:198
SDLK_KP_CLEARENTRY
Definition: SDL_keycode.h:266
SDLK_END
Definition: SDL_keycode.h:146
SDLK_UNKNOWN
Definition: SDL_keycode.h:49
KMOD_RGUI
Definition: SDL_keycode.h:327
SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:152
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
SDLK_KP_PLUSMINUS
Definition: SDL_keycode.h:264
SDLK_ESCAPE
Definition: SDL_keycode.h:52
SDL_SetKeymap
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
Definition: SDL_keyboard.c:585
SDLK_HOME
Definition: SDL_keycode.h:143
SDLK_KP_4
Definition: SDL_keycode.h:162
SDLK_KP_POWER
Definition: SDL_keycode.h:239
SDL_scancode_names
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:277
SDL_GetKeyFromScancode
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode)
Get the key code corresponding to the given scancode according to the current keyboard layout...
Definition: SDL_keyboard.c:859
SDLK_KP_LEFTPAREN
Definition: SDL_keycode.h:226
SDLK_RETURN
Definition: SDL_keycode.h:51
SDLK_CLEAR
Definition: SDL_keycode.h:207
SDL_Event::text
SDL_TextInputEvent text
Definition: SDL_events.h:502
SDLK_AC_REFRESH
Definition: SDL_keycode.h:299
SDLK_KP_6
Definition: SDL_keycode.h:164
SDL_TextInputEvent::text
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
Definition: SDL_events.h:212
SDLK_RSHIFT
Definition: SDL_keycode.h:278
dst
GLenum GLenum dst
Definition: glew.h:2396
SDLK_OUT
Definition: SDL_keycode.h:211
SDLK_KP_2
Definition: SDL_keycode.h:160
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:701
SDLK_KP_TAB
Definition: SDL_keycode.h:230
SDLK_LGUI
Definition: SDL_keycode.h:276
SDL_SCANCODE_ESCAPE
Definition: SDL_scancode.h:93
SDL_SCANCODE_SPACE
Definition: SDL_scancode.h:96
length
GLsizei GLsizei * length
Definition: gl2ext.h:792
SDLK_KP_5
Definition: SDL_keycode.h:163
SDLK_DISPLAYSWITCH
Definition: SDL_keycode.h:305
SDLK_CURRENCYSUBUNIT
Definition: SDL_keycode.h:224
SDLK_KP_VERTICALBAR
Definition: SDL_keycode.h:246
SDL_SendKeyboardText
int SDL_SendKeyboardText(const char *text)
Definition: SDL_keyboard.c:784
SDLK_KP_DIVIDE
Definition: SDL_keycode.h:154
SDLK_AC_BACK
Definition: SDL_keycode.h:296
SDLK_STOP
Definition: SDL_keycode.h:190
KMOD_CAPS
Definition: SDL_keycode.h:329
KMOD_MODE
Definition: SDL_keycode.h:330
SDLK_F12
Definition: SDL_keycode.h:137
SDL_KEYUP
Definition: SDL_events.h:94
SDLK_AUDIONEXT
Definition: SDL_keycode.h:284
p
GLfloat GLfloat p
Definition: glew.h:14938
SDLK_KP_AT
Definition: SDL_keycode.h:253
KMOD_NUM
Definition: SDL_keycode.h:328
SDLK_PRINTSCREEN
Definition: SDL_keycode.h:139
SDLK_FIND
Definition: SDL_keycode.h:196
SDLK_KP_3
Definition: SDL_keycode.h:161
SDLK_KP_COMMA
Definition: SDL_keycode.h:200
SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:153
SDL_default_keymap
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:48
SDLK_MAIL
Definition: SDL_keycode.h:291
SDLK_OPER
Definition: SDL_keycode.h:212
SDLK_KBDILLUMTOGGLE
Definition: SDL_keycode.h:306
SDLK_LALT
Definition: SDL_keycode.h:275
SDL_TextEditingEvent::text
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: SDL_events.h:197
SDL_GetScancodeFromKey
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key)
Get the scancode corresponding to the given key code according to the current keyboard layout...
Definition: SDL_keyboard.c:872
SDLK_KP_7
Definition: SDL_keycode.h:165
SDLK_ALTERASE
Definition: SDL_keycode.h:204
SDL_SCANCODE_LCTRL
Definition: SDL_scancode.h:328
SDLK_KP_MEMSTORE
Definition: SDL_keycode.h:255
SDL_GetKeyFromName
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
Definition: SDL_keyboard.c:964
SDLK_KP_000
Definition: SDL_keycode.h:218
SDLK_KP_PERIOD
Definition: SDL_keycode.h:169
SDL_SetScancodeName
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
Definition: SDL_keyboard.c:597
SDLK_RETURN2
Definition: SDL_keycode.h:209
SDL_SCANCODE_LSHIFT
Definition: SDL_scancode.h:329
SDL_SCANCODE_BACKSPACE
Definition: SDL_scancode.h:94
SDLK_MUTE
Definition: SDL_keycode.h:197
SDL_GetScancodeName
DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
Definition: SDL_keyboard.c:887
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:827
SDL_Keymod
SDL_Keymod
Enumeration of valid key mods (possibly OR&#39;d together).
Definition: SDL_keycode.h:317
SDLK_PAGEDOWN
Definition: SDL_keycode.h:147
SDLK_KP_B
Definition: SDL_keycode.h:233
SDLK_KP_ENTER
Definition: SDL_keycode.h:158
SDLK_DOWN
Definition: SDL_keycode.h:150
SDLK_KP_DECIMAL
Definition: SDL_keycode.h:269
SDLK_SPACE
Definition: SDL_keycode.h:55
SDL_strlen
DECLSPEC size_t SDLCALL SDL_strlen(const char *str)
Definition: SDL_string.c:389
SDLK_F11
Definition: SDL_keycode.h:136
SDL_events_c.h
SDLK_KP_8
Definition: SDL_keycode.h:166
SDLK_KP_A
Definition: SDL_keycode.h:232
SDLK_KP_MINUS
Definition: SDL_keycode.h:156
SDLK_KP_0
Definition: SDL_keycode.h:168
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:83
SDL_Event::edit
SDL_TextEditingEvent edit
Definition: SDL_events.h:501
SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
SDLK_MODE
Definition: SDL_keycode.h:282
SDLK_LCTRL
Definition: SDL_keycode.h:273
SDLK_KP_MEMRECALL
Definition: SDL_keycode.h:256
SDLK_UP
Definition: SDL_keycode.h:151
SDLK_F10
Definition: SDL_keycode.h:135
SDLK_KP_HEXADECIMAL
Definition: SDL_keycode.h:270
SDL_SCANCODE_NUMLOCKCLEAR
Definition: SDL_scancode.h:181
SDLK_RGUI
Definition: SDL_keycode.h:280
SDL_memcpy
DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len)
Definition: SDL_string.c:293
KMOD_LGUI
Definition: SDL_keycode.h:326
SDLK_KP_C
Definition: SDL_keycode.h:234
SDLK_BRIGHTNESSDOWN
Definition: SDL_keycode.h:302
SDLK_RALT
Definition: SDL_keycode.h:279
SDL_TEXTINPUT
Definition: SDL_events.h:96
SDLK_KP_GREATER
Definition: SDL_keycode.h:242
SDL_SCANCODE_DELETE
Definition: SDL_scancode.h:173
KMOD_LALT
Definition: SDL_keycode.h:324
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
SDLK_KP_CLEAR
Definition: SDL_keycode.h:265
SDLK_KP_XOR
Definition: SDL_keycode.h:238
SDLK_KP_MEMDIVIDE
Definition: SDL_keycode.h:263
SDL_Window
Definition: SDL_sysvideo.h:71
SDL_SCANCODE_LGUI
Definition: SDL_scancode.h:331
SDL_ResetKeyboard
void SDL_ResetKeyboard(void)
Definition: SDL_keyboard.c:563
SDL_NUM_SCANCODES
Definition: SDL_scancode.h:395
SDL_SetModState
DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
Definition: SDL_keyboard.c:851
SDLK_MEDIASELECT
Definition: SDL_keycode.h:289
SDL_keyboard
static SDL_Keyboard SDL_keyboard
Definition: SDL_keyboard.c:46
SDLK_CALCULATOR
Definition: SDL_keycode.h:292
SDLK_KP_RIGHTPAREN
Definition: SDL_keycode.h:227
SDL_SCANCODE_RGUI
Definition: SDL_scancode.h:335
SDLK_SCROLLLOCK
Definition: SDL_keycode.h:140
SDLK_AC_HOME
Definition: SDL_keycode.h:295
KMOD_RALT
Definition: SDL_keycode.h:325
SDLK_AC_STOP
Definition: SDL_keycode.h:298
SDLK_COPY
Definition: SDL_keycode.h:194
SDLK_WWW
Definition: SDL_keycode.h:290
SDLK_F22
Definition: SDL_keycode.h:183
SDLK_KP_F
Definition: SDL_keycode.h:237
SDLK_F19
Definition: SDL_keycode.h:180
SDL_VideoDevice
Definition: SDL_sysvideo.h:135
end
GLuint GLuint end
Definition: glew.h:1239
SDLK_F20
Definition: SDL_keycode.h:181
SDL_GetVideoDevice
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:548
SDLK_CURRENCYUNIT
Definition: SDL_keycode.h:223
SDLK_PAGEUP
Definition: SDL_keycode.h:144
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:137
SDLK_F5
Definition: SDL_keycode.h:130
SDL_Event
General event structure.
Definition: SDL_events.h:495
SDLK_KP_E
Definition: SDL_keycode.h:236
SDLK_MENU
Definition: SDL_keycode.h:188
SDL_GetKeyboardFocus
DECLSPEC SDL_Window *SDLCALL SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
Definition: SDL_keyboard.c:603
SDLK_AUDIOMUTE
Definition: SDL_keycode.h:288
SDL_UCS4ToUTF8
static char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
Definition: SDL_keyboard.c:511
SDL_SCANCODE_MODE
Definition: SDL_scancode.h:337
SDLK_THOUSANDSSEPARATOR
Definition: SDL_keycode.h:219
SDLK_F4
Definition: SDL_keycode.h:129
SDLK_EXECUTE
Definition: SDL_keycode.h:186
SDLK_F7
Definition: SDL_keycode.h:132
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:243
SDL_QUERY
#define SDL_QUERY
Definition: SDL_events.h:685
SDLK_NUMLOCKCLEAR
Definition: SDL_keycode.h:153
i
int i
Definition: pngrutil.c:1377
SDLK_AC_SEARCH
Definition: SDL_keycode.h:294
SDL_timer.h
SDLK_BRIGHTNESSUP
Definition: SDL_keycode.h:304
SDLK_TAB
Definition: SDL_keycode.h:54
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDLK_KP_MEMMULTIPLY
Definition: SDL_keycode.h:261
SDLK_RIGHT
Definition: SDL_keycode.h:148
SDLK_KBDILLUMUP
Definition: SDL_keycode.h:309
KMOD_RSHIFT
Definition: SDL_keycode.h:321
SDL_GetModState
DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void)
Get the current key modifier state for the keyboard.
Definition: SDL_keyboard.c:843
SDLK_KP_9
Definition: SDL_keycode.h:167
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
SDL_strcasecmp
DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2)
Definition: SDL_string.c:946
SDL_SCANCODE_RALT
Definition: SDL_scancode.h:334
SDLK_KP_1
Definition: SDL_keycode.h:159
SDL_SendEditingText
int SDL_SendEditingText(const char *text, int start, int length)
Definition: SDL_keyboard.c:807
SDLK_POWER
Definition: SDL_keycode.h:172
SDL_TEXTEDITING
Definition: SDL_events.h:95
SDLK_SEPARATOR
Definition: SDL_keycode.h:210
SDLK_APPLICATION
Definition: SDL_keycode.h:171
SDLK_INSERT
Definition: SDL_keycode.h:142
SDL_SCANCODE_RSHIFT
Definition: SDL_scancode.h:333
event
cl_event event
Definition: glew.h:3556
SDLK_F14
Definition: SDL_keycode.h:175
SDL_SCANCODE_RCTRL
Definition: SDL_scancode.h:332
SDLK_PAUSE
Definition: SDL_keycode.h:141