28 #include "../video/SDL_sysvideo.h"
179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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,
408 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
422 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
425 "ThousandsSeparator",
459 "Keypad MemSubtract",
460 "Keypad MemMultiply",
468 "Keypad Hexadecimal",
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,
517 }
else if (ch <= 0x7FF) {
518 p[0] = 0xC0 | (
Uint8) ((ch >> 6) & 0x1F);
519 p[1] = 0x80 | (
Uint8) (ch & 0x3F);
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);
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);
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);
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);
568 #ifdef DEBUG_KEYBOARD
569 printf(
"Resetting keyboard\n");
593 SDL_memcpy(&keyboard->keymap[start], keys,
sizeof(*keys) * length);
607 return keyboard->focus;
615 if (keyboard->focus && !window) {
621 if (keyboard->focus && keyboard->focus != window) {
634 keyboard->focus = window;
636 if (keyboard->focus) {
661 #ifdef DEBUG_KEYBOARD
666 modstate = keyboard->modstate;
739 modstate = keyboard->modstate;
756 repeat = (state && keyboard->keystate[scancode]);
757 if (keyboard->keystate[scancode] == state && !repeat) {
759 printf(
"Keyboard event didn't change state - dropped!\n");
765 keyboard->keystate[scancode] = state;
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;
790 if ((
unsigned char)*text <
' ' || *text == 127) {
799 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
817 event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
818 event.edit.start =
start;
819 event.edit.length =
length;
836 if (numkeys != (
int *) 0) {
839 return keyboard->keystate;
847 return keyboard->modstate;
855 keyboard->modstate = modstate;
868 return keyboard->keymap[scancode];
879 if (keyboard->keymap[scancode] == key) {
906 if (!name || !*name) {
953 if (key >=
'a' && key <=
'z') {
972 key = *(
const unsigned char *)name;
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);
983 }
else if (key >= 0xE0) {
986 key = (
Uint16)(name[i]&0x0F) << 12;
987 key |= (
Uint16)(name[++i]&0x3F) << 6;
988 key |= (
Uint16)(name[++i]&0x3F);
992 }
else if (key >= 0xC0) {
995 key = (
Uint16)(name[i]&0x1F) << 6;
996 key |= (
Uint16)(name[++i]&0x3F);
1002 if (key >=
'A' && key <=
'Z') {
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
void SDL_SetKeyboardFocus(SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
void(* StopTextInput)(_THIS)
struct SDL_Keyboard SDL_Keyboard
#define SDLK_SCANCODE_MASK
DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
EGLImageKHR EGLint * name
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes)
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.
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
uint32_t Uint32
An unsigned 32-bit integer type.
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode)
Get the key code corresponding to the given scancode according to the current keyboard layout...
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
#define SDL_GetEventState(type)
int SDL_SendKeyboardText(const char *text)
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key)
Get the scancode corresponding to the given key code according to the current keyboard layout...
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
void SDL_KeyboardQuit(void)
SDL_Keymod
Enumeration of valid key mods (possibly OR'd together).
DECLSPEC size_t SDLCALL SDL_strlen(const char *str)
#define SDL_arraysize(array)
SDL_TextEditingEvent edit
DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len)
uint8_t Uint8
An unsigned 8-bit integer type.
void SDL_ResetKeyboard(void)
DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
static SDL_Keyboard SDL_keyboard
SDL_VideoDevice * SDL_GetVideoDevice(void)
uint16_t Uint16
An unsigned 16-bit integer type.
DECLSPEC SDL_Window *SDLCALL SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
static char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
void(* StartTextInput)(_THIS)
DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void)
Get the current key modifier state for the keyboard.
SDL_Scancode
The SDL keyboard scancode representation.
DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2)
int SDL_SendEditingText(const char *text, int start, int length)