Go to the documentation of this file.
21 #include "../SDL_internal.h"
29 #include "../video/SDL_sysvideo.h"
180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
193 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
249 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,
413 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
427 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
430 "ThousandsSeparator",
464 "Keypad MemSubtract",
465 "Keypad MemMultiply",
473 "Keypad Hexadecimal",
483 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
484 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
526 }
else if (ch <= 0x7FF) {
527 p[0] = 0xC0 | (
Uint8) ((ch >> 6) & 0x1F);
528 p[1] = 0x80 | (
Uint8) (ch & 0x3F);
530 }
else if (ch <= 0xFFFF) {
531 p[0] = 0xE0 | (
Uint8) ((ch >> 12) & 0x0F);
532 p[1] = 0x80 | (
Uint8) ((ch >> 6) & 0x3F);
533 p[2] = 0x80 | (
Uint8) (ch & 0x3F);
535 }
else if (ch <= 0x1FFFFF) {
536 p[0] = 0xF0 | (
Uint8) ((ch >> 18) & 0x07);
537 p[1] = 0x80 | (
Uint8) ((ch >> 12) & 0x3F);
538 p[2] = 0x80 | (
Uint8) ((ch >> 6) & 0x3F);
539 p[3] = 0x80 | (
Uint8) (ch & 0x3F);
541 }
else if (ch <= 0x3FFFFFF) {
542 p[0] = 0xF8 | (
Uint8) ((ch >> 24) & 0x03);
543 p[1] = 0x80 | (
Uint8) ((ch >> 18) & 0x3F);
544 p[2] = 0x80 | (
Uint8) ((ch >> 12) & 0x3F);
545 p[3] = 0x80 | (
Uint8) ((ch >> 6) & 0x3F);
546 p[4] = 0x80 | (
Uint8) (ch & 0x3F);
549 p[0] = 0xFC | (
Uint8) ((ch >> 30) & 0x01);
550 p[1] = 0x80 | (
Uint8) ((ch >> 24) & 0x3F);
551 p[2] = 0x80 | (
Uint8) ((ch >> 18) & 0x3F);
552 p[3] = 0x80 | (
Uint8) ((ch >> 12) & 0x3F);
553 p[4] = 0x80 | (
Uint8) ((ch >> 6) & 0x3F);
554 p[5] = 0x80 | (
Uint8) (ch & 0x3F);
577 #ifdef DEBUG_KEYBOARD
578 printf(
"Resetting keyboard\n");
626 return keyboard->
focus;
665 if (keyboard->
focus) {
691 #ifdef DEBUG_KEYBOARD
713 printf(
"Keyboard event didn't change state - dropped!\n");
721 keycode = keyboard->
keymap[scancode];
776 event.key.type =
type;
777 event.key.state =
state;
778 event.key.repeat = repeat;
779 event.key.keysym.scancode = scancode;
780 event.key.keysym.sym = keycode;
781 event.key.keysym.mod = keyboard->
modstate;
782 event.key.windowID = keyboard->
focus ? keyboard->
focus->
id : 0;
795 if ((
unsigned char)*
text <
' ' || *
text == 127) {
804 event.text.windowID = keyboard->
focus ? keyboard->
focus->
id : 0;
822 event.edit.windowID = keyboard->
focus ? keyboard->
focus->
id : 0;
823 event.edit.start =
start;
824 event.edit.length =
length;
841 if (numkeys != (
int *) 0) {
886 return keyboard->
keymap[scancode];
971 if (
key >=
'a' &&
key <=
'z') {
992 key = *(
const unsigned char *)
name;
1003 }
else if (
key >= 0xE0) {
1012 }
else if (
key >= 0xC0) {
1022 if (
key >=
'A' &&
key <=
'Z') {
@ SDL_WINDOW_MOUSE_CAPTURE
const char * SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
@ SDLK_THOUSANDSSEPARATOR
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
Get the key code corresponding to the given scancode according to the current keyboard layout.
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
@ SDL_WINDOWEVENT_FOCUS_LOST
Uint8 keystate[SDL_NUM_SCANCODES]
char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
SDL_Scancode
The SDL keyboard scancode representation.
#define SDL_InvalidParamError(param)
void SDL_SetKeyboardFocus(SDL_Window *window)
SDL_Keymod
Enumeration of valid key mods (possibly OR'd together).
Sint32 SDL_Keycode
The SDL virtual key representation.
GLuint GLsizei GLsizei * length
void SDL_KeyboardQuit(void)
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
The type used to identify a window.
SDL_Keycode SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
void SDL_ResetKeyboard(void)
int SDL_SendKeyboardText(const char *text)
int SDL_SendEditingText(const char *text, int start, int length)
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
void SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
#define SDL_GetEventState(type)
EGLSurface EGLNativeWindowType * window
const Uint8 * SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
SDL_Keycode keymap[SDL_NUM_SCANCODES]
GLuint const GLchar * name
void(* StartTextInput)(_THIS)
static char text[MAX_TEXT_LENGTH]
void(* StopTextInput)(_THIS)
#define SDL_assert(condition)
const char * SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
#define SDLK_SCANCODE_MASK
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
#define SDL_arraysize(array)
SDL_Window * SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
int SDL_KeyboardInit(void)
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
Get the scancode corresponding to the given key code according to the current keyboard layout.
SDL_Keymod SDL_GetModState(void)
Get the current key modifier state for the keyboard.
SDL_VideoDevice * SDL_GetVideoDevice(void)
@ SDL_WINDOWEVENT_FOCUS_GAINED
GLuint GLuint GLsizei GLenum type
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)
SDL_Scancode SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
static SDL_Keyboard SDL_keyboard