SDL_keyboard.c
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
/* General keyboard handling code for SDL */
#include "SDL_timer.h"
#include "SDL_events.h"
#include "SDL_events_c.h"
#include "SDL_assert.h"
#include "../video/SDL_sysvideo.h"
/* #define DEBUG_KEYBOARD */
/* Global keyboard information */
typedef struct SDL_Keyboard SDL_Keyboard;
struct SDL_Keyboard
{
/* Data common to all keyboards */
SDL_Window *focus;
Uint16 modstate;
Uint8 keystate[SDL_NUM_SCANCODES];
SDL_Keycode keymap[SDL_NUM_SCANCODES];
};
static SDL_Keyboard SDL_keyboard;
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
0, 0, 0, 0,
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'0',
SDLK_RETURN,
SDLK_ESCAPE,
SDLK_BACKSPACE,
SDLK_TAB,
SDLK_SPACE,
'-',
'=',
'[',
']',
'\\',
'#',
';',
'\'',
'`',
',',
'.',
'/',
SDLK_CAPSLOCK,
SDLK_F1,
SDLK_F2,
SDLK_F3,
SDLK_F4,
SDLK_F5,
SDLK_F6,
SDLK_F7,
SDLK_F8,
SDLK_F9,
SDLK_F10,
SDLK_F11,
SDLK_F12,
SDLK_PRINTSCREEN,
SDLK_SCROLLLOCK,
SDLK_PAUSE,
SDLK_INSERT,
SDLK_HOME,
SDLK_PAGEUP,
SDLK_DELETE,
SDLK_END,
SDLK_PAGEDOWN,
SDLK_RIGHT,
SDLK_LEFT,
SDLK_DOWN,
SDLK_UP,
SDLK_NUMLOCKCLEAR,
SDLK_KP_DIVIDE,
SDLK_KP_MULTIPLY,
SDLK_KP_MINUS,
SDLK_KP_PLUS,
SDLK_KP_ENTER,
SDLK_KP_1,
SDLK_KP_2,
SDLK_KP_3,
SDLK_KP_4,
SDLK_KP_5,
SDLK_KP_6,
SDLK_KP_7,
SDLK_KP_8,
SDLK_KP_9,
SDLK_KP_0,
SDLK_KP_PERIOD,
0,
SDLK_APPLICATION,
SDLK_POWER,
SDLK_KP_EQUALS,
SDLK_F13,
SDLK_F14,
SDLK_F15,
SDLK_F16,
SDLK_F17,
SDLK_F18,
SDLK_F19,
SDLK_F20,
SDLK_F21,
SDLK_F22,
SDLK_F23,
SDLK_F24,
SDLK_EXECUTE,
SDLK_HELP,
SDLK_MENU,
SDLK_SELECT,
SDLK_STOP,
SDLK_AGAIN,
SDLK_UNDO,
SDLK_CUT,
SDLK_COPY,
SDLK_PASTE,
SDLK_FIND,
SDLK_MUTE,
SDLK_VOLUMEUP,
SDLK_VOLUMEDOWN,
0, 0, 0,
SDLK_KP_COMMA,
SDLK_KP_EQUALSAS400,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
SDLK_ALTERASE,
SDLK_SYSREQ,
SDLK_CANCEL,
SDLK_CLEAR,
SDLK_PRIOR,
SDLK_RETURN2,
SDLK_SEPARATOR,
SDLK_OUT,
SDLK_OPER,
SDLK_CLEARAGAIN,
SDLK_CRSEL,
SDLK_EXSEL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
SDLK_KP_00,
SDLK_KP_000,
SDLK_THOUSANDSSEPARATOR,
SDLK_DECIMALSEPARATOR,
SDLK_CURRENCYUNIT,
SDLK_CURRENCYSUBUNIT,
SDLK_KP_LEFTPAREN,
SDLK_KP_RIGHTPAREN,
SDLK_KP_LEFTBRACE,
SDLK_KP_RIGHTBRACE,
SDLK_KP_TAB,
SDLK_KP_BACKSPACE,
SDLK_KP_A,
SDLK_KP_B,
SDLK_KP_C,
SDLK_KP_D,
SDLK_KP_E,
SDLK_KP_F,
SDLK_KP_XOR,
SDLK_KP_POWER,
SDLK_KP_PERCENT,
SDLK_KP_LESS,
SDLK_KP_GREATER,
SDLK_KP_AMPERSAND,
SDLK_KP_DBLAMPERSAND,
SDLK_KP_VERTICALBAR,
SDLK_KP_DBLVERTICALBAR,
SDLK_KP_COLON,
SDLK_KP_HASH,
SDLK_KP_SPACE,
SDLK_KP_AT,
SDLK_KP_EXCLAM,
SDLK_KP_MEMSTORE,
SDLK_KP_MEMRECALL,
SDLK_KP_MEMCLEAR,
SDLK_KP_MEMADD,
SDLK_KP_MEMSUBTRACT,
SDLK_KP_MEMMULTIPLY,
SDLK_KP_MEMDIVIDE,
SDLK_KP_PLUSMINUS,
SDLK_KP_CLEAR,
SDLK_KP_CLEARENTRY,
SDLK_KP_BINARY,
SDLK_KP_OCTAL,
SDLK_KP_DECIMAL,
SDLK_KP_HEXADECIMAL,
0, 0,
SDLK_LCTRL,
SDLK_LSHIFT,
SDLK_LALT,
SDLK_LGUI,
SDLK_RCTRL,
SDLK_RSHIFT,
SDLK_RALT,
SDLK_RGUI,
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,
SDLK_MODE,
SDLK_AUDIONEXT,
SDLK_AUDIOPREV,
SDLK_AUDIOSTOP,
SDLK_AUDIOPLAY,
SDLK_AUDIOMUTE,
SDLK_MEDIASELECT,
SDLK_WWW,
SDLK_MAIL,
SDLK_CALCULATOR,
SDLK_COMPUTER,
SDLK_AC_SEARCH,
SDLK_AC_HOME,
SDLK_AC_BACK,
SDLK_AC_FORWARD,
SDLK_AC_STOP,
SDLK_AC_REFRESH,
SDLK_AC_BOOKMARKS,
SDLK_BRIGHTNESSDOWN,
SDLK_BRIGHTNESSUP,
SDLK_DISPLAYSWITCH,
SDLK_KBDILLUMTOGGLE,
SDLK_KBDILLUMDOWN,
SDLK_KBDILLUMUP,
SDLK_EJECT,
SDLK_SLEEP,
SDLK_APP1,
SDLK_APP2,
SDLK_AUDIOREWIND,
SDLK_AUDIOFASTFORWARD,
};
static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
NULL, NULL, NULL, NULL,
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"Return",
"Escape",
"Backspace",
"Tab",
"Space",
"-",
"=",
"[",
"]",
"\\",
"#",
";",
"'",
"`",
",",
".",
"/",
"CapsLock",
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12",
"PrintScreen",
"ScrollLock",
"Pause",
"Insert",
"Home",
"PageUp",
"Delete",
"End",
"PageDown",
"Right",
"Left",
"Down",
"Up",
"Numlock",
"Keypad /",
"Keypad *",
"Keypad -",
"Keypad +",
"Keypad Enter",
"Keypad 1",
"Keypad 2",
"Keypad 3",
"Keypad 4",
"Keypad 5",
"Keypad 6",
"Keypad 7",
"Keypad 8",
"Keypad 9",
"Keypad 0",
"Keypad .",
NULL,
"Application",
"Power",
"Keypad =",
"F13",
"F14",
"F15",
"F16",
"F17",
"F18",
"F19",
"F20",
"F21",
"F22",
"F23",
"F24",
"Execute",
"Help",
"Menu",
"Select",
"Stop",
"Again",
"Undo",
"Cut",
"Copy",
"Paste",
"Find",
"Mute",
"VolumeUp",
"VolumeDown",
NULL, NULL, NULL,
"Keypad ,",
"Keypad = (AS400)",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
"AltErase",
"SysReq",
"Cancel",
"Clear",
"Prior",
"Return",
"Separator",
"Out",
"Oper",
"Clear / Again",
"CrSel",
"ExSel",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"Keypad 00",
"Keypad 000",
"ThousandsSeparator",
"DecimalSeparator",
"CurrencyUnit",
"CurrencySubUnit",
"Keypad (",
"Keypad )",
"Keypad {",
"Keypad }",
"Keypad Tab",
"Keypad Backspace",
"Keypad A",
"Keypad B",
"Keypad C",
"Keypad D",
"Keypad E",
"Keypad F",
"Keypad XOR",
"Keypad ^",
"Keypad %",
"Keypad <",
"Keypad >",
"Keypad &",
"Keypad &&",
"Keypad |",
"Keypad ||",
"Keypad :",
"Keypad #",
"Keypad Space",
"Keypad @",
"Keypad !",
"Keypad MemStore",
"Keypad MemRecall",
"Keypad MemClear",
"Keypad MemAdd",
"Keypad MemSubtract",
"Keypad MemMultiply",
"Keypad MemDivide",
"Keypad +/-",
"Keypad Clear",
"Keypad ClearEntry",
"Keypad Binary",
"Keypad Octal",
"Keypad Decimal",
"Keypad Hexadecimal",
NULL, NULL,
"Left Ctrl",
"Left Shift",
"Left Alt",
"Left GUI",
"Right Ctrl",
"Right Shift",
"Right Alt",
"Right GUI",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
"ModeSwitch",
"AudioNext",
"AudioPrev",
"AudioStop",
"AudioPlay",
"AudioMute",
"MediaSelect",
"WWW",
"Mail",
"Calculator",
"Computer",
"AC Search",
"AC Home",
"AC Back",
"AC Forward",
"AC Stop",
"AC Refresh",
"AC Bookmarks",
"BrightnessDown",
"BrightnessUp",
"DisplaySwitch",
"KBDIllumToggle",
"KBDIllumDown",
"KBDIllumUp",
"Eject",
"Sleep",
"App1",
"App2",
"AudioRewind",
"AudioFastForward",
};
/* Taken from SDL_iconv() */
char *
SDL_UCS4ToUTF8(Uint32 ch, char *dst)
{
Uint8 *p = (Uint8 *) dst;
if (ch <= 0x7F) {
*p = (Uint8) ch;
++dst;
} else if (ch <= 0x7FF) {
p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
p[1] = 0x80 | (Uint8) (ch & 0x3F);
dst += 2;
} else if (ch <= 0xFFFF) {
p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[2] = 0x80 | (Uint8) (ch & 0x3F);
dst += 3;
} else if (ch <= 0x1FFFFF) {
p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[3] = 0x80 | (Uint8) (ch & 0x3F);
dst += 4;
} else if (ch <= 0x3FFFFFF) {
p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[4] = 0x80 | (Uint8) (ch & 0x3F);
dst += 5;
} else {
p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[5] = 0x80 | (Uint8) (ch & 0x3F);
dst += 6;
}
return dst;
}
/* Public functions */
int
SDL_KeyboardInit(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
/* Set the default keymap */
SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
return (0);
}
void
SDL_ResetKeyboard(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;
#ifdef DEBUG_KEYBOARD
printf("Resetting keyboard\n");
#endif
for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
if (keyboard->keystate[scancode] == SDL_PRESSED) {
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
}
}
}
void
SDL_GetDefaultKeymap(SDL_Keycode * keymap)
{
SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
}
void
SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;
if (start < 0 || start + length > SDL_NUM_SCANCODES) {
return;
}
SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length);
/* The number key scancodes always map to the number key keycodes.
* On AZERTY layouts these technically are symbols, but users (and games)
* always think of them and view them in UI as number keys.
*/
keyboard->keymap[SDL_SCANCODE_0] = SDLK_0;
for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) {
keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1);
}
}
void
SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
{
SDL_scancode_names[scancode] = name;
}
SDL_Window *
SDL_GetKeyboardFocus(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
return keyboard->focus;
}
void
SDL_SetKeyboardFocus(SDL_Window * window)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (keyboard->focus && !window) {
/* We won't get anymore keyboard messages, so reset keyboard state */
SDL_ResetKeyboard();
}
/* See if the current window has lost focus */
if (keyboard->focus && keyboard->focus != window) {
/* new window shouldn't think it has mouse captured. */
SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
/* old window must lose an existing mouse capture. */
if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
SDL_CaptureMouse(SDL_FALSE); /* drop the capture. */
SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
}
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
0, 0);
/* Ensures IME compositions are committed */
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StopTextInput) {
video->StopTextInput(video);
}
}
}
keyboard->focus = window;
if (keyboard->focus) {
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
0, 0);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StartTextInput) {
video->StartTextInput(video);
}
}
}
}
int
SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
int posted;
SDL_Keymod modifier;
SDL_Keycode keycode;
Uint32 type;
Uint8 repeat;
if (!scancode) {
return 0;
}
#ifdef DEBUG_KEYBOARD
printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
state == SDL_PRESSED ? "pressed" : "released");
#endif
/* Figure out what type of event this is */
switch (state) {
case SDL_PRESSED:
type = SDL_KEYDOWN;
break;
case SDL_RELEASED:
type = SDL_KEYUP;
break;
default:
/* Invalid state -- bail */
return 0;
}
/* Drop events that don't change state */
repeat = (state && keyboard->keystate[scancode]);
if (keyboard->keystate[scancode] == state && !repeat) {
#if 0
printf("Keyboard event didn't change state - dropped!\n");
#endif
return 0;
}
/* Update internal keyboard state */
keyboard->keystate[scancode] = state;
keycode = keyboard->keymap[scancode];
/* Update modifiers state if applicable */
switch (keycode) {
case SDLK_LCTRL:
modifier = KMOD_LCTRL;
break;
case SDLK_RCTRL:
modifier = KMOD_RCTRL;
break;
case SDLK_LSHIFT:
modifier = KMOD_LSHIFT;
break;
case SDLK_RSHIFT:
modifier = KMOD_RSHIFT;
break;
case SDLK_LALT:
modifier = KMOD_LALT;
break;
case SDLK_RALT:
modifier = KMOD_RALT;
break;
case SDLK_LGUI:
modifier = KMOD_LGUI;
break;
case SDLK_RGUI:
modifier = KMOD_RGUI;
break;
case SDLK_MODE:
modifier = KMOD_MODE;
break;
default:
modifier = KMOD_NONE;
break;
}
if (SDL_KEYDOWN == type) {
switch (keycode) {
case SDLK_NUMLOCKCLEAR:
keyboard->modstate ^= KMOD_NUM;
break;
case SDLK_CAPSLOCK:
keyboard->modstate ^= KMOD_CAPS;
break;
default:
keyboard->modstate |= modifier;
break;
}
} else {
keyboard->modstate &= ~modifier;
}
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(type) == SDL_ENABLE) {
SDL_Event event;
event.key.type = type;
event.key.state = state;
event.key.repeat = repeat;
event.key.keysym.scancode = scancode;
event.key.keysym.sym = keycode;
event.key.keysym.mod = keyboard->modstate;
event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
}
int
SDL_SendKeyboardText(const char *text)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
int posted;
/* Don't post text events for unprintable characters */
if ((unsigned char)*text < ' ' || *text == 127) {
return 0;
}
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
SDL_Event event;
event.text.type = SDL_TEXTINPUT;
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
}
int
SDL_SendEditingText(const char *text, int start, int length)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
int posted;
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
SDL_Event event;
event.edit.type = SDL_TEXTEDITING;
event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
event.edit.start = start;
event.edit.length = length;
SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
}
void
SDL_KeyboardQuit(void)
{
}
const Uint8 *
SDL_GetKeyboardState(int *numkeys)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (numkeys != (int *) 0) {
*numkeys = SDL_NUM_SCANCODES;
}
return keyboard->keystate;
}
SDL_Keymod
SDL_GetModState(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
return (SDL_Keymod) keyboard->modstate;
}
void
SDL_SetModState(SDL_Keymod modstate)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
keyboard->modstate = modstate;
}
/* Note that SDL_ToggleModState() is not a public API. SDL_SetModState() is. */
void
SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (toggle) {
keyboard->modstate |= modstate;
} else {
keyboard->modstate &= ~modstate;
}
}
SDL_Keycode
SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return 0;
}
return keyboard->keymap[scancode];
}
SDL_Scancode
SDL_GetScancodeFromKey(SDL_Keycode key)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
++scancode) {
if (keyboard->keymap[scancode] == key) {
return scancode;
}
}
return SDL_SCANCODE_UNKNOWN;
}
const char *
SDL_GetScancodeName(SDL_Scancode scancode)
{
const char *name;
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return "";
}
name = SDL_scancode_names[scancode];
if (name)
return name;
else
return "";
}
SDL_Scancode SDL_GetScancodeFromName(const char *name)
{
int i;
if (!name || !*name) {
SDL_InvalidParamError("name");
return SDL_SCANCODE_UNKNOWN;
}
for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
if (!SDL_scancode_names[i]) {
continue;
}
if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
return (SDL_Scancode)i;
}
}
SDL_InvalidParamError("name");
return SDL_SCANCODE_UNKNOWN;
}
const char *
SDL_GetKeyName(SDL_Keycode key)
{
static char name[8];
char *end;
if (key & SDLK_SCANCODE_MASK) {
return
SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
}
switch (key) {
case SDLK_RETURN:
return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
case SDLK_ESCAPE:
return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
case SDLK_BACKSPACE:
return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
case SDLK_TAB:
return SDL_GetScancodeName(SDL_SCANCODE_TAB);
case SDLK_SPACE:
return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
case SDLK_DELETE:
return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
default:
/* Unaccented letter keys on latin keyboards are normally
labeled in upper case (and probably on others like Greek or
Cyrillic too, so if you happen to know for sure, please
adapt this). */
if (key >= 'a' && key <= 'z') {
key -= 32;
}
end = SDL_UCS4ToUTF8((Uint32) key, name);
*end = '\0';
return name;
}
}
SDL_Keycode
SDL_GetKeyFromName(const char *name)
{
SDL_Keycode key;
/* Check input */
if (name == NULL) {
return SDLK_UNKNOWN;
}
/* If it's a single UTF-8 character, then that's the keycode itself */
key = *(const unsigned char *)name;
if (key >= 0xF0) {
if (SDL_strlen(name) == 4) {
int i = 0;
key = (Uint16)(name[i]&0x07) << 18;
key |= (Uint16)(name[++i]&0x3F) << 12;
key |= (Uint16)(name[++i]&0x3F) << 6;
key |= (Uint16)(name[++i]&0x3F);
return key;
}
return SDLK_UNKNOWN;
} else if (key >= 0xE0) {
if (SDL_strlen(name) == 3) {
int i = 0;
key = (Uint16)(name[i]&0x0F) << 12;
key |= (Uint16)(name[++i]&0x3F) << 6;
key |= (Uint16)(name[++i]&0x3F);
return key;
}
return SDLK_UNKNOWN;
} else if (key >= 0xC0) {
if (SDL_strlen(name) == 2) {
int i = 0;
key = (Uint16)(name[i]&0x1F) << 6;
key |= (Uint16)(name[++i]&0x3F);
return key;
}
return SDLK_UNKNOWN;
} else {
if (SDL_strlen(name) == 1) {
if (key >= 'A' && key <= 'Z') {
key += 32;
}
return key;
}
/* Get the scancode for this name, and the associated keycode */
return SDL_default_keymap[SDL_GetScancodeFromName(name)];
}
}
/* vi: set ts=4 sw=4 expandtab: */
SDLK_OUT
Definition: SDL_keycode.h:214
SDLK_SLEEP
Definition: SDL_keycode.h:314
SDLK_CLEARAGAIN
Definition: SDL_keycode.h:216
SDL_GetDefaultKeymap
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
Definition: SDL_keyboard.c:588
SDLK_KP_LEFTBRACE
Definition: SDL_keycode.h:231
SDL_SCANCODE_RETURN
Definition: SDL_scancode.h:92
SDLK_KP_C
Definition: SDL_keycode.h:237
SDLK_DELETE
Definition: SDL_keycode.h:148
SDLK_RGUI
Definition: SDL_keycode.h:283
SDLK_KP_MEMMULTIPLY
Definition: SDL_keycode.h:264
SDLK_KP_DBLVERTICALBAR
Definition: SDL_keycode.h:251
SDLK_KP_HEXADECIMAL
Definition: SDL_keycode.h:273
SDLK_APPLICATION
Definition: SDL_keycode.h:174
SDL_KEYDOWN
Definition: SDL_events.h:93
SDLK_UNDO
Definition: SDL_keycode.h:195
SDLK_KP_RIGHTPAREN
Definition: SDL_keycode.h:230
KMOD_LCTRL
Definition: SDL_keycode.h:330
SDLK_F17
Definition: SDL_keycode.h:181
SDLK_BACKSPACE
Definition: SDL_keycode.h:56
SDLK_KP_D
Definition: SDL_keycode.h:238
SDLK_KP_CLEARENTRY
Definition: SDL_keycode.h:269
SDLK_VOLUMEUP
Definition: SDL_keycode.h:201
SDLK_MEDIASELECT
Definition: SDL_keycode.h:292
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
SDLK_KP_7
Definition: SDL_keycode.h:168
SDLK_MENU
Definition: SDL_keycode.h:191
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDLK_MUTE
Definition: SDL_keycode.h:200
SDLK_KP_MEMSTORE
Definition: SDL_keycode.h:258
SDLK_RSHIFT
Definition: SDL_keycode.h:281
SDLK_KP_BACKSPACE
Definition: SDL_keycode.h:234
KMOD_RCTRL
Definition: SDL_keycode.h:331
SDLK_KP_LESS
Definition: SDL_keycode.h:244
SDLK_PAGEUP
Definition: SDL_keycode.h:147
KMOD_LSHIFT
Definition: SDL_keycode.h:328
SDLK_HELP
Definition: SDL_keycode.h:190
SDLK_KP_EXCLAM
Definition: SDL_keycode.h:257
SDLK_KP_2
Definition: SDL_keycode.h:163
SDLK_F4
Definition: SDL_keycode.h:132
SDL_FALSE
Definition: SDL_stdinc.h:141
end
GLuint GLuint end
Definition: SDL_opengl.h:1571
state
struct xkb_state * state
Definition: SDL_waylandsym.h:113
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
SDLK_KP_VERTICALBAR
Definition: SDL_keycode.h:249
SDL_utf8strlcpy
#define SDL_utf8strlcpy
Definition: SDL_dynapi_overrides.h:395
SDL_events.h
SDLK_KP_AT
Definition: SDL_keycode.h:256
SDLK_KP_3
Definition: SDL_keycode.h:164
SDLK_PASTE
Definition: SDL_keycode.h:198
SDLK_MODE
Definition: SDL_keycode.h:285
SDLK_KP_CLEAR
Definition: SDL_keycode.h:268
SDLK_TAB
Definition: SDL_keycode.h:57
SDLK_0
Definition: SDL_keycode.h:74
SDLK_KP_HASH
Definition: SDL_keycode.h:254
SDLK_KP_AMPERSAND
Definition: SDL_keycode.h:246
SDLK_KP_COLON
Definition: SDL_keycode.h:253
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:722
SDLK_F16
Definition: SDL_keycode.h:180
SDLK_KBDILLUMTOGGLE
Definition: SDL_keycode.h:309
SDLK_SCANCODE_MASK
#define SDLK_SCANCODE_MASK
Definition: SDL_keycode.h:47
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:286
SDLK_STOP
Definition: SDL_keycode.h:193
SDLK_LALT
Definition: SDL_keycode.h:278
SDLK_END
Definition: SDL_keycode.h:149
SDLK_RIGHT
Definition: SDL_keycode.h:151
start
GLuint start
Definition: SDL_opengl.h:1571
SDLK_F20
Definition: SDL_keycode.h:184
SDLK_KP_9
Definition: SDL_keycode.h:170
SDL_Keyboard::keymap
SDL_Keycode keymap[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:44
SDLK_COMPUTER
Definition: SDL_keycode.h:296
SDL_GetKeyFromName
SDL_Keycode SDL_GetKeyFromName(const char *name)
Get a key code from a human-readable name.
Definition: SDL_keyboard.c:982
SDLK_CALCULATOR
Definition: SDL_keycode.h:295
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:88
SDLK_SEPARATOR
Definition: SDL_keycode.h:213
SDL_KeyboardInit
int SDL_KeyboardInit(void)
Definition: SDL_keyboard.c:562
SDL_Keyboard
Definition: SDL_keyboard.c:38
SDLK_KP_GREATER
Definition: SDL_keycode.h:245
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:419
SDLK_F2
Definition: SDL_keycode.h:130
SDLK_CAPSLOCK
Definition: SDL_keycode.h:127
SDLK_F22
Definition: SDL_keycode.h:186
SDLK_SCROLLLOCK
Definition: SDL_keycode.h:143
SDL_Keycode
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:45
SDLK_KP_PLUSMINUS
Definition: SDL_keycode.h:267
SDLK_AUDIOMUTE
Definition: SDL_keycode.h:291
SDLK_AC_HOME
Definition: SDL_keycode.h:298
SDL_SCANCODE_TAB
Definition: SDL_scancode.h:95
SDLK_RETURN
Definition: SDL_keycode.h:54
KMOD_NONE
Definition: SDL_keycode.h:327
SDLK_CANCEL
Definition: SDL_keycode.h:209
SDLK_RCTRL
Definition: SDL_keycode.h:280
SDL_GetKeyFromScancode
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:877
SDLK_KP_B
Definition: SDL_keycode.h:236
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDLK_KP_ENTER
Definition: SDL_keycode.h:161
SDLK_PAGEDOWN
Definition: SDL_keycode.h:150
SDL_SendKeyboardKey
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
Definition: SDL_keyboard.c:679
SDLK_KP_A
Definition: SDL_keycode.h:235
SDLK_KP_BINARY
Definition: SDL_keycode.h:270
SDLK_KP_MINUS
Definition: SDL_keycode.h:159
SDLK_KP_PERIOD
Definition: SDL_keycode.h:172
SDLK_CUT
Definition: SDL_keycode.h:196
SDL_SCANCODE_9
Definition: SDL_scancode.h:89
SDLK_AUDIOPLAY
Definition: SDL_keycode.h:290
SDLK_KP_SPACE
Definition: SDL_keycode.h:255
SDLK_AC_SEARCH
Definition: SDL_keycode.h:297
KMOD_RGUI
Definition: SDL_keycode.h:335
SDLK_1
Definition: SDL_keycode.h:75
SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:165
SDL_SetKeymap
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
Definition: SDL_keyboard.c:594
SDL_Keyboard::modstate
Uint16 modstate
Definition: SDL_keyboard.c:42
SDLK_DISPLAYSWITCH
Definition: SDL_keycode.h:308
SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:116
SDL_scancode_names
static const char * SDL_scancode_names[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:282
SDLK_AUDIOFASTFORWARD
Definition: SDL_keycode.h:319
SDL_GetKeyboardState
const Uint8 * SDL_GetKeyboardState(int *numkeys)
Get a snapshot of the current state of the keyboard.
Definition: SDL_keyboard.c:837
SDLK_F24
Definition: SDL_keycode.h:188
SDLK_F21
Definition: SDL_keycode.h:185
SDLK_BRIGHTNESSUP
Definition: SDL_keycode.h:307
SDLK_RALT
Definition: SDL_keycode.h:282
SDLK_BRIGHTNESSDOWN
Definition: SDL_keycode.h:305
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDLK_KP_COMMA
Definition: SDL_keycode.h:203
SDL_Event::text
SDL_TextInputEvent text
Definition: SDL_events.h:532
SDLK_SYSREQ
Definition: SDL_keycode.h:208
SDL_TextInputEvent::text
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
Definition: SDL_events.h:226
SDL_SetModState
void SDL_SetModState(SDL_Keymod modstate)
Set the current key modifier state for the keyboard.
Definition: SDL_keyboard.c:856
SDLK_F12
Definition: SDL_keycode.h:140
key
GLuint64 key
Definition: gl2ext.h:2192
SDLK_MAIL
Definition: SDL_keycode.h:294
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:735
SDL_SCANCODE_ESCAPE
Definition: SDL_scancode.h:93
SDL_SCANCODE_SPACE
Definition: SDL_scancode.h:96
SDLK_POWER
Definition: SDL_keycode.h:175
SDL_GetScancodeFromName
SDL_Scancode SDL_GetScancodeFromName(const char *name)
Get a scancode from a human-readable name.
Definition: SDL_keyboard.c:920
SDLK_KP_MULTIPLY
Definition: SDL_keycode.h:158
SDLK_HOME
Definition: SDL_keycode.h:146
SDL_SCANCODE_0
Definition: SDL_scancode.h:90
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
SDL_SendKeyboardText
int SDL_SendKeyboardText(const char *text)
Definition: SDL_keyboard.c:789
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
KMOD_CAPS
Definition: SDL_keycode.h:337
KMOD_MODE
Definition: SDL_keycode.h:338
SDL_GetModState
SDL_Keymod SDL_GetModState(void)
Get the current key modifier state for the keyboard.
Definition: SDL_keyboard.c:848
SDL_KEYUP
Definition: SDL_events.h:94
SDLK_PAUSE
Definition: SDL_keycode.h:144
SDLK_F5
Definition: SDL_keycode.h:133
SDLK_KP_MEMSUBTRACT
Definition: SDL_keycode.h:262
KMOD_NUM
Definition: SDL_keycode.h:336
SDLK_AC_REFRESH
Definition: SDL_keycode.h:302
SDL_PushEvent
#define SDL_PushEvent
Definition: SDL_dynapi_overrides.h:125
SDLK_KP_F
Definition: SDL_keycode.h:240
SDLK_KP_TAB
Definition: SDL_keycode.h:233
SDLK_THOUSANDSSEPARATOR
Definition: SDL_keycode.h:222
SDL_GetScancodeName
const char * SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
Definition: SDL_keyboard.c:905
SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:166
SDL_default_keymap
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:49
SDLK_EXSEL
Definition: SDL_keycode.h:218
SDLK_KP_DECIMAL
Definition: SDL_keycode.h:272
SDLK_AGAIN
Definition: SDL_keycode.h:194
SDLK_AUDIONEXT
Definition: SDL_keycode.h:287
SDL_TextEditingEvent::text
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: SDL_events.h:211
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:287
SDLK_AUDIOREWIND
Definition: SDL_keycode.h:318
SDLK_APP1
Definition: SDL_keycode.h:315
SDL_GetScancodeFromKey
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:890
SDLK_LCTRL
Definition: SDL_keycode.h:276
SDLK_KP_5
Definition: SDL_keycode.h:166
SDLK_KP_6
Definition: SDL_keycode.h:167
SDLK_F6
Definition: SDL_keycode.h:134
SDLK_KP_PLUS
Definition: SDL_keycode.h:160
SDLK_KP_00
Definition: SDL_keycode.h:220
SDLK_F8
Definition: SDL_keycode.h:136
SDLK_F23
Definition: SDL_keycode.h:187
SDLK_AUDIOPREV
Definition: SDL_keycode.h:288
SDLK_OPER
Definition: SDL_keycode.h:215
SDLK_KP_0
Definition: SDL_keycode.h:171
SDL_SetScancodeName
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
Definition: SDL_keyboard.c:616
SDL_SCANCODE_BACKSPACE
Definition: SDL_scancode.h:94
SDLK_PRINTSCREEN
Definition: SDL_keycode.h:142
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:832
SDL_Keymod
SDL_Keymod
Enumeration of valid key mods (possibly OR&#39;d together).
Definition: SDL_keycode.h:325
SDLK_KP_MEMRECALL
Definition: SDL_keycode.h:259
i
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
SDL_ToggleModState
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
Definition: SDL_keyboard.c:865
SDLK_KP_PERCENT
Definition: SDL_keycode.h:243
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDLK_KP_XOR
Definition: SDL_keycode.h:241
SDLK_KP_MEMDIVIDE
Definition: SDL_keycode.h:266
SDL_events_c.h
SDLK_KP_OCTAL
Definition: SDL_keycode.h:271
SDLK_LEFT
Definition: SDL_keycode.h:152
NULL
#define NULL
Definition: begin_code.h:164
SDLK_CRSEL
Definition: SDL_keycode.h:217
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDLK_F18
Definition: SDL_keycode.h:182
SDL_Event::edit
SDL_TextEditingEvent edit
Definition: SDL_events.h:531
SDLK_KBDILLUMDOWN
Definition: SDL_keycode.h:311
SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
SDLK_KP_POWER
Definition: SDL_keycode.h:242
SDL_UCS4ToUTF8
char * SDL_UCS4ToUTF8(Uint32 ch, char *dst)
Definition: SDL_keyboard.c:520
SDLK_F19
Definition: SDL_keycode.h:183
SDLK_CLEAR
Definition: SDL_keycode.h:210
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
SDLK_UNKNOWN
Definition: SDL_keycode.h:52
SDLK_KP_4
Definition: SDL_keycode.h:165
SDLK_COPY
Definition: SDL_keycode.h:197
SDLK_SELECT
Definition: SDL_keycode.h:192
SDLK_KP_000
Definition: SDL_keycode.h:221
SDL_Keyboard::focus
SDL_Window * focus
Definition: SDL_keyboard.c:41
KMOD_LGUI
Definition: SDL_keycode.h:334
SDLK_AUDIOSTOP
Definition: SDL_keycode.h:289
SDL_TEXTINPUT
Definition: SDL_events.h:96
SDLK_F1
Definition: SDL_keycode.h:129
SDLK_AC_FORWARD
Definition: SDL_keycode.h:300
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_SCANCODE_DELETE
Definition: SDL_scancode.h:173
SDLK_DOWN
Definition: SDL_keycode.h:153
SDLK_F15
Definition: SDL_keycode.h:179
SDLK_F7
Definition: SDL_keycode.h:135
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
KMOD_LALT
Definition: SDL_keycode.h:332
SDLK_DECIMALSEPARATOR
Definition: SDL_keycode.h:224
SDLK_F11
Definition: SDL_keycode.h:139
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:73
SDLK_LSHIFT
Definition: SDL_keycode.h:277
SDLK_F3
Definition: SDL_keycode.h:131
SDL_EventState
#define SDL_EventState
Definition: SDL_dynapi_overrides.h:131
SDL_ResetKeyboard
void SDL_ResetKeyboard(void)
Definition: SDL_keyboard.c:572
SDL_NUM_SCANCODES
Definition: SDL_scancode.h:407
SDLK_NUMLOCKCLEAR
Definition: SDL_keycode.h:156
SDL_keyboard
static SDL_Keyboard SDL_keyboard
Definition: SDL_keyboard.c:47
SDL_SCANCODE_1
Definition: SDL_scancode.h:81
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:76
SDL_CaptureMouse
#define SDL_CaptureMouse
Definition: SDL_dynapi_overrides.h:584
KMOD_RALT
Definition: SDL_keycode.h:333
SDL_VideoDevice
Definition: SDL_sysvideo.h:147
SDLK_F10
Definition: SDL_keycode.h:138
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
SDLK_F9
Definition: SDL_keycode.h:137
type
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
SDL_GetVideoDevice
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:586
SDLK_FIND
Definition: SDL_keycode.h:199
SDLK_UP
Definition: SDL_keycode.h:154
SDLK_AC_BACK
Definition: SDL_keycode.h:299
SDL_GetKeyboardFocus
SDL_Window * SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
Definition: SDL_keyboard.c:622
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
SDL_Event
General event structure.
Definition: SDL_events.h:525
SDLK_F14
Definition: SDL_keycode.h:178
SDLK_ALTERASE
Definition: SDL_keycode.h:207
SDLK_KP_DIVIDE
Definition: SDL_keycode.h:157
SDLK_PRIOR
Definition: SDL_keycode.h:211
SDLK_KBDILLUMUP
Definition: SDL_keycode.h:312
SDLK_AC_BOOKMARKS
Definition: SDL_keycode.h:303
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_QUERY
#define SDL_QUERY
Definition: SDL_events.h:719
SDLK_VOLUMEDOWN
Definition: SDL_keycode.h:202
SDLK_KP_EQUALS
Definition: SDL_keycode.h:176
SDL_GetKeyName
const char * SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
Definition: SDL_keyboard.c:943
SDLK_F13
Definition: SDL_keycode.h:177
SDLK_INSERT
Definition: SDL_keycode.h:145
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:669
SDL_Keyboard::keystate
Uint8 keystate[SDL_NUM_SCANCODES]
Definition: SDL_keyboard.c:43
SDL_timer.h
SDLK_ESCAPE
Definition: SDL_keycode.h:55
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:83
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDLK_KP_RIGHTBRACE
Definition: SDL_keycode.h:232
SDLK_KP_MEMCLEAR
Definition: SDL_keycode.h:260
SDLK_LGUI
Definition: SDL_keycode.h:279
SDLK_EJECT
Definition: SDL_keycode.h:313
SDLK_KP_MEMADD
Definition: SDL_keycode.h:261
KMOD_RSHIFT
Definition: SDL_keycode.h:329
SDLK_CURRENCYUNIT
Definition: SDL_keycode.h:226
SDLK_EXECUTE
Definition: SDL_keycode.h:189
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
SDLK_KP_8
Definition: SDL_keycode.h:169
SDLK_SPACE
Definition: SDL_keycode.h:58
SDL_SendEditingText
int SDL_SendEditingText(const char *text, int start, int length)
Definition: SDL_keyboard.c:812
SDL_TEXTEDITING
Definition: SDL_events.h:95
SDLK_CURRENCYSUBUNIT
Definition: SDL_keycode.h:227
SDLK_RETURN2
Definition: SDL_keycode.h:212
SDLK_KP_DBLAMPERSAND
Definition: SDL_keycode.h:247
SDLK_AC_STOP
Definition: SDL_keycode.h:301
SDLK_KP_E
Definition: SDL_keycode.h:239
SDLK_WWW
Definition: SDL_keycode.h:293
SDL_assert.h
SDLK_APP2
Definition: SDL_keycode.h:316
SDLK_KP_LEFTPAREN
Definition: SDL_keycode.h:229
SDLK_KP_EQUALSAS400
Definition: SDL_keycode.h:204
SDLK_KP_1
Definition: SDL_keycode.h:162