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;
634 if (keyboard->
focus && !window) {
640 if (keyboard->
focus && keyboard->
focus != window) {
665 if (keyboard->
focus) {
691 #ifdef DEBUG_KEYBOARD 710 repeat = (state && keyboard->
keystate[scancode]);
711 if (keyboard->
keystate[scancode] == state && !repeat) {
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];
897 if (keyboard->
keymap[scancode] == key) {
924 if (!name || !*name) {
971 if (key >=
'a' && key <=
'z') {
992 key = *(
const unsigned char *)name;
996 key = (
Uint16)(name[i]&0x07) << 18;
997 key |= (
Uint16)(name[++i]&0x3F) << 12;
998 key |= (
Uint16)(name[++i]&0x3F) << 6;
999 key |= (
Uint16)(name[++i]&0x3F);
1003 }
else if (key >= 0xE0) {
1006 key = (
Uint16)(name[i]&0x0F) << 12;
1007 key |= (
Uint16)(name[++i]&0x3F) << 6;
1008 key |= (
Uint16)(name[++i]&0x3F);
1012 }
else if (key >= 0xC0) {
1015 key = (
Uint16)(name[i]&0x1F) << 6;
1016 key |= (
Uint16)(name[++i]&0x3F);
1022 if (key >=
'A' && key <=
'Z') {
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
void SDL_SetKeyboardFocus(SDL_Window *window)
#define SDLK_SCANCODE_MASK
void(* StartTextInput)(_THIS)
SDL_Keycode keymap[SDL_NUM_SCANCODES]
SDL_Keycode SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
int SDL_KeyboardInit(void)
#define SDL_InvalidParamError(param)
Sint32 SDL_Keycode
The SDL virtual key representation.
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
Get the key code corresponding to the given scancode according to the current keyboard layout...
GLuint const GLchar * name
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
const Uint8 * SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
void SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
#define SDL_GetEventState(type)
SDL_Scancode SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
int SDL_SendKeyboardText(const char *text)
SDL_Keymod SDL_GetModState(void)
Get the current key modifier state for the keyboard.
const char * SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
void(* StopTextInput)(_THIS)
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
Get the scancode corresponding to the given key code according to the current keyboard layout...
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
void SDL_KeyboardQuit(void)
SDL_Keymod
Enumeration of valid key mods (possibly OR'd together).
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)
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
#define SDL_assert(condition)
SDL_TextEditingEvent edit
char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
static char text[MAX_TEXT_LENGTH]
EGLSurface EGLNativeWindowType * window
The type used to identify a window.
void SDL_ResetKeyboard(void)
static SDL_Keyboard SDL_keyboard
GLuint GLuint GLsizei GLenum type
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_Window * SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
#define SDL_arraysize(array)
const char * SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
GLuint GLsizei GLsizei * length
Uint8 keystate[SDL_NUM_SCANCODES]
SDL_Scancode
The SDL keyboard scancode representation.
int SDL_SendEditingText(const char *text, int start, int length)