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