21 #include "../SDL_internal.h"
28 #include "../video/SDL_sysvideo.h"
35 #define KEYBOARD_HARDWARE 0x01
36 #define KEYBOARD_AUTORELEASE 0x02
184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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,
417 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
431 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
434 "ThousandsSeparator",
468 "Keypad MemSubtract",
469 "Keypad MemMultiply",
477 "Keypad Hexadecimal",
487 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
488 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
530 }
else if (ch <= 0x7FF) {
531 p[0] = 0xC0 | (
Uint8) ((ch >> 6) & 0x1F);
532 p[1] = 0x80 | (
Uint8) (ch & 0x3F);
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);
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);
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);
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);
581 #ifdef DEBUG_KEYBOARD
582 printf(
"Resetting keyboard\n");
630 return keyboard->
focus;
669 if (keyboard->
focus) {
696 #ifdef DEBUG_KEYBOARD
725 if (!keyboard->
keystate[scancode]) {
734 keycode = keyboard->
keymap[scancode];
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;
854 if ((
unsigned char)*
text <
' ' || *
text == 127) {
863 event.text.windowID = keyboard->
focus ? keyboard->
focus->
id : 0;
881 event.edit.windowID = keyboard->
focus ? keyboard->
focus->
id : 0;
882 event.edit.start =
start;
883 event.edit.length =
length;
900 if (numkeys != (
int *) 0) {
945 return keyboard->
keymap[scancode];
1004 static char name[8];
1030 if (
key >=
'a' &&
key <=
'z') {
1051 key = *(
const unsigned char *)
name;
1062 }
else if (
key >= 0xE0) {
1071 }
else if (
key >= 0xC0) {
1081 if (
key >=
'A' &&
key <=
'Z') {
#define SDL_assert(condition)
#define SDL_InvalidParamError(param)
#define SDL_GetEventState(type)
SDL_Scancode SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
int SDL_KeyboardInit(void)
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
SDL_Keymod SDL_GetModState(void)
Get the current key modifier state for the keyboard.
int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode)
char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
Get the scancode corresponding to the given key code according to the current keyboard layout.
int SDL_SendEditingText(const char *text, int start, int length)
const char * SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
SDL_Window * SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
#define KEYBOARD_HARDWARE
void SDL_ResetKeyboard(void)
static int SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode)
SDL_bool SDL_HardwareKeyboardKeyPressed(void)
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
Get the key code corresponding to the given scancode according to the current keyboard layout.
void SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
void SDL_SetKeyboardFocus(SDL_Window *window)
#define KEYBOARD_AUTORELEASE
void SDL_KeyboardQuit(void)
int SDL_SendKeyboardText(const char *text)
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
SDL_Keycode SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
static SDL_Keyboard SDL_keyboard
const Uint8 * SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
const char * SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
void SDL_ReleaseAutoReleaseKeys(void)
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
@ SDLK_THOUSANDSSEPARATOR
#define SDLK_SCANCODE_MASK
Sint32 SDL_Keycode
The SDL virtual key representation.
SDL_Keymod
Enumeration of valid key mods (possibly OR'd together).
GLuint GLuint GLsizei GLenum type
GLsizei GLsizei GLchar * source
GLuint const GLchar * name
GLuint GLsizei GLsizei * length
SDL_Scancode
The SDL keyboard scancode representation.
#define SDL_arraysize(array)
SDL_VideoDevice * SDL_GetVideoDevice(void)
@ SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOWEVENT_FOCUS_LOST
@ SDL_WINDOWEVENT_FOCUS_GAINED
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)
EGLSurface EGLNativeWindowType * window
Uint8 keystate[SDL_NUM_SCANCODES]
Uint8 keysource[SDL_NUM_SCANCODES]
SDL_bool autorelease_pending
SDL_Keycode keymap[SDL_NUM_SCANCODES]
void(* StartTextInput)(_THIS)
void(* StopTextInput)(_THIS)
The type used to identify a window.
static char text[MAX_TEXT_LENGTH]