SDL_x11keyboard.c
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 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"
#if SDL_VIDEO_DRIVER_X11
#include "SDL_x11video.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/scancodes_darwin.h"
#include "../../events/scancodes_xfree86.h"
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include "imKStoUCS.h"
#ifdef X_HAVE_UTF8_STRING
#include <locale.h>
#endif
/* *INDENT-OFF* */
static const struct {
KeySym keysym;
SDL_Scancode scancode;
} KeySymToSDLScancode[] = {
{ XK_Return, SDL_SCANCODE_RETURN },
{ XK_Escape, SDL_SCANCODE_ESCAPE },
{ XK_BackSpace, SDL_SCANCODE_BACKSPACE },
{ XK_Tab, SDL_SCANCODE_TAB },
{ XK_Caps_Lock, SDL_SCANCODE_CAPSLOCK },
{ XK_F1, SDL_SCANCODE_F1 },
{ XK_F2, SDL_SCANCODE_F2 },
{ XK_F3, SDL_SCANCODE_F3 },
{ XK_F4, SDL_SCANCODE_F4 },
{ XK_F5, SDL_SCANCODE_F5 },
{ XK_F6, SDL_SCANCODE_F6 },
{ XK_F7, SDL_SCANCODE_F7 },
{ XK_F8, SDL_SCANCODE_F8 },
{ XK_F9, SDL_SCANCODE_F9 },
{ XK_F10, SDL_SCANCODE_F10 },
{ XK_F11, SDL_SCANCODE_F11 },
{ XK_F12, SDL_SCANCODE_F12 },
{ XK_Print, SDL_SCANCODE_PRINTSCREEN },
{ XK_Scroll_Lock, SDL_SCANCODE_SCROLLLOCK },
{ XK_Pause, SDL_SCANCODE_PAUSE },
{ XK_Insert, SDL_SCANCODE_INSERT },
{ XK_Home, SDL_SCANCODE_HOME },
{ XK_Prior, SDL_SCANCODE_PAGEUP },
{ XK_Delete, SDL_SCANCODE_DELETE },
{ XK_End, SDL_SCANCODE_END },
{ XK_Next, SDL_SCANCODE_PAGEDOWN },
{ XK_Right, SDL_SCANCODE_RIGHT },
{ XK_Left, SDL_SCANCODE_LEFT },
{ XK_Down, SDL_SCANCODE_DOWN },
{ XK_Up, SDL_SCANCODE_UP },
{ XK_Num_Lock, SDL_SCANCODE_NUMLOCKCLEAR },
{ XK_KP_Divide, SDL_SCANCODE_KP_DIVIDE },
{ XK_KP_Multiply, SDL_SCANCODE_KP_MULTIPLY },
{ XK_KP_Subtract, SDL_SCANCODE_KP_MINUS },
{ XK_KP_Add, SDL_SCANCODE_KP_PLUS },
{ XK_KP_Enter, SDL_SCANCODE_KP_ENTER },
{ XK_KP_Delete, SDL_SCANCODE_KP_PERIOD },
{ XK_KP_End, SDL_SCANCODE_KP_1 },
{ XK_KP_Down, SDL_SCANCODE_KP_2 },
{ XK_KP_Next, SDL_SCANCODE_KP_3 },
{ XK_KP_Left, SDL_SCANCODE_KP_4 },
{ XK_KP_Begin, SDL_SCANCODE_KP_5 },
{ XK_KP_Right, SDL_SCANCODE_KP_6 },
{ XK_KP_Home, SDL_SCANCODE_KP_7 },
{ XK_KP_Up, SDL_SCANCODE_KP_8 },
{ XK_KP_Prior, SDL_SCANCODE_KP_9 },
{ XK_KP_Insert, SDL_SCANCODE_KP_0 },
{ XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD },
{ XK_KP_1, SDL_SCANCODE_KP_1 },
{ XK_KP_2, SDL_SCANCODE_KP_2 },
{ XK_KP_3, SDL_SCANCODE_KP_3 },
{ XK_KP_4, SDL_SCANCODE_KP_4 },
{ XK_KP_5, SDL_SCANCODE_KP_5 },
{ XK_KP_6, SDL_SCANCODE_KP_6 },
{ XK_KP_7, SDL_SCANCODE_KP_7 },
{ XK_KP_8, SDL_SCANCODE_KP_8 },
{ XK_KP_9, SDL_SCANCODE_KP_9 },
{ XK_KP_0, SDL_SCANCODE_KP_0 },
{ XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD },
{ XK_Hyper_R, SDL_SCANCODE_APPLICATION },
{ XK_KP_Equal, SDL_SCANCODE_KP_EQUALS },
{ XK_F13, SDL_SCANCODE_F13 },
{ XK_F14, SDL_SCANCODE_F14 },
{ XK_F15, SDL_SCANCODE_F15 },
{ XK_F16, SDL_SCANCODE_F16 },
{ XK_F17, SDL_SCANCODE_F17 },
{ XK_F18, SDL_SCANCODE_F18 },
{ XK_F19, SDL_SCANCODE_F19 },
{ XK_F20, SDL_SCANCODE_F20 },
{ XK_F21, SDL_SCANCODE_F21 },
{ XK_F22, SDL_SCANCODE_F22 },
{ XK_F23, SDL_SCANCODE_F23 },
{ XK_F24, SDL_SCANCODE_F24 },
{ XK_Execute, SDL_SCANCODE_EXECUTE },
{ XK_Help, SDL_SCANCODE_HELP },
{ XK_Menu, SDL_SCANCODE_MENU },
{ XK_Select, SDL_SCANCODE_SELECT },
{ XK_Cancel, SDL_SCANCODE_STOP },
{ XK_Redo, SDL_SCANCODE_AGAIN },
{ XK_Undo, SDL_SCANCODE_UNDO },
{ XK_Find, SDL_SCANCODE_FIND },
{ XK_KP_Separator, SDL_SCANCODE_KP_COMMA },
{ XK_Sys_Req, SDL_SCANCODE_SYSREQ },
{ XK_Control_L, SDL_SCANCODE_LCTRL },
{ XK_Shift_L, SDL_SCANCODE_LSHIFT },
{ XK_Alt_L, SDL_SCANCODE_LALT },
{ XK_Meta_L, SDL_SCANCODE_LGUI },
{ XK_Super_L, SDL_SCANCODE_LGUI },
{ XK_Control_R, SDL_SCANCODE_RCTRL },
{ XK_Shift_R, SDL_SCANCODE_RSHIFT },
{ XK_Alt_R, SDL_SCANCODE_RALT },
{ XK_ISO_Level3_Shift, SDL_SCANCODE_RALT },
{ XK_Meta_R, SDL_SCANCODE_RGUI },
{ XK_Super_R, SDL_SCANCODE_RGUI },
{ XK_Mode_switch, SDL_SCANCODE_MODE },
{ XK_period, SDL_SCANCODE_PERIOD },
{ XK_comma, SDL_SCANCODE_COMMA },
{ XK_slash, SDL_SCANCODE_SLASH },
{ XK_backslash, SDL_SCANCODE_BACKSLASH },
{ XK_minus, SDL_SCANCODE_MINUS },
{ XK_equal, SDL_SCANCODE_EQUALS },
{ XK_space, SDL_SCANCODE_SPACE },
{ XK_grave, SDL_SCANCODE_GRAVE },
{ XK_apostrophe, SDL_SCANCODE_APOSTROPHE },
{ XK_bracketleft, SDL_SCANCODE_LEFTBRACKET },
{ XK_bracketright, SDL_SCANCODE_RIGHTBRACKET },
};
static const struct
{
SDL_Scancode const *table;
int table_size;
} scancode_set[] = {
{ darwin_scancode_table, SDL_arraysize(darwin_scancode_table) },
{ xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) },
{ xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) },
{ xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) },
};
/* *INDENT-OFF* */
/* This function only works for keyboards in US QWERTY layout */
static SDL_Scancode
X11_KeyCodeToSDLScancode(_THIS, KeyCode keycode)
{
KeySym keysym;
int i;
keysym = X11_KeyCodeToSym(_this, keycode, 0);
if (keysym == NoSymbol) {
return SDL_SCANCODE_UNKNOWN;
}
if (keysym >= XK_a && keysym <= XK_z) {
return SDL_SCANCODE_A + (keysym - XK_a);
}
if (keysym >= XK_A && keysym <= XK_Z) {
return SDL_SCANCODE_A + (keysym - XK_A);
}
if (keysym == XK_0) {
return SDL_SCANCODE_0;
}
if (keysym >= XK_1 && keysym <= XK_9) {
return SDL_SCANCODE_1 + (keysym - XK_1);
}
for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) {
if (keysym == KeySymToSDLScancode[i].keysym) {
return KeySymToSDLScancode[i].scancode;
}
}
return SDL_SCANCODE_UNKNOWN;
}
static Uint32
X11_KeyCodeToUcs4(_THIS, KeyCode keycode, unsigned char group)
{
KeySym keysym = X11_KeyCodeToSym(_this, keycode, group);
if (keysym == NoSymbol) {
return 0;
}
return X11_KeySymToUcs4(keysym);
}
KeySym
X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
KeySym keysym;
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
if (data->xkb) {
int num_groups = XkbKeyNumGroups(data->xkb, keycode);
unsigned char info = XkbKeyGroupInfo(data->xkb, keycode);
if (num_groups && group >= num_groups) {
int action = XkbOutOfRangeGroupAction(info);
if (action == XkbRedirectIntoRange) {
if ((group = XkbOutOfRangeGroupNumber(info)) >= num_groups) {
group = 0;
}
} else if (action == XkbClampIntoRange) {
group = num_groups - 1;
} else {
group %= num_groups;
}
}
keysym = X11_XkbKeycodeToKeysym(data->display, keycode, group, 0);
} else {
keysym = X11_XKeycodeToKeysym(data->display, keycode, 0);
}
#else
keysym = X11_XKeycodeToKeysym(data->display, keycode, 0);
#endif
return keysym;
}
int
X11_InitKeyboard(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
int i = 0;
int j = 0;
int min_keycode, max_keycode;
struct {
SDL_Scancode scancode;
KeySym keysym;
int value;
} fingerprint[] = {
{ SDL_SCANCODE_HOME, XK_Home, 0 },
{ SDL_SCANCODE_PAGEUP, XK_Prior, 0 },
{ SDL_SCANCODE_UP, XK_Up, 0 },
{ SDL_SCANCODE_LEFT, XK_Left, 0 },
{ SDL_SCANCODE_DELETE, XK_Delete, 0 },
{ SDL_SCANCODE_KP_ENTER, XK_KP_Enter, 0 },
};
int best_distance;
int best_index;
int distance;
Bool xkb_repeat = 0;
X11_XAutoRepeatOn(data->display);
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
{
int xkb_major = XkbMajorVersion;
int xkb_minor = XkbMinorVersion;
if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
}
/* This will remove KeyRelease events for held keys */
X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat);
}
#endif
/* Open a connection to the X input manager */
#ifdef X_HAVE_UTF8_STRING
if (SDL_X11_HAVE_UTF8) {
/* Set the locale, and call XSetLocaleModifiers before XOpenIM so that
Compose keys will work correctly. */
char *prev_locale = setlocale(LC_ALL, NULL);
char *prev_xmods = X11_XSetLocaleModifiers(NULL);
const char *new_xmods = "";
const char *env_xmods = SDL_getenv("XMODIFIERS");
SDL_bool has_dbus_ime_support = SDL_FALSE;
if (prev_locale) {
prev_locale = SDL_strdup(prev_locale);
}
if (prev_xmods) {
prev_xmods = SDL_strdup(prev_xmods);
}
/* IBus resends some key events that were filtered by XFilterEvents
when it is used via XIM which causes issues. Prevent this by forcing
@im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
the DBus implementation, which also has support for pre-editing. */
if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
has_dbus_ime_support = SDL_TRUE;
}
if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
has_dbus_ime_support = SDL_TRUE;
}
if (has_dbus_ime_support || !xkb_repeat) {
new_xmods = "@im=none";
}
setlocale(LC_ALL, "");
X11_XSetLocaleModifiers(new_xmods);
data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
/* Reset the locale + X locale modifiers back to how they were,
locale first because the X locale modifiers depend on it. */
setlocale(LC_ALL, prev_locale);
X11_XSetLocaleModifiers(prev_xmods);
if (prev_locale) {
SDL_free(prev_locale);
}
if (prev_xmods) {
SDL_free(prev_xmods);
}
}
#endif
/* Try to determine which scancodes are being used based on fingerprint */
best_distance = SDL_arraysize(fingerprint) + 1;
best_index = -1;
X11_XDisplayKeycodes(data->display, &min_keycode, &max_keycode);
for (i = 0; i < SDL_arraysize(fingerprint); ++i) {
fingerprint[i].value =
X11_XKeysymToKeycode(data->display, fingerprint[i].keysym) -
min_keycode;
}
for (i = 0; i < SDL_arraysize(scancode_set); ++i) {
/* Make sure the scancode set isn't too big */
if ((max_keycode - min_keycode + 1) <= scancode_set[i].table_size) {
continue;
}
distance = 0;
for (j = 0; j < SDL_arraysize(fingerprint); ++j) {
if (fingerprint[j].value < 0
|| fingerprint[j].value >= scancode_set[i].table_size) {
distance += 1;
} else if (scancode_set[i].table[fingerprint[j].value] != fingerprint[j].scancode) {
distance += 1;
}
}
if (distance < best_distance) {
best_distance = distance;
best_index = i;
}
}
if (best_index >= 0 && best_distance <= 2) {
#ifdef DEBUG_KEYBOARD
printf("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, scancode_set[best_index].table_size);
#endif
SDL_memcpy(&data->key_layout[min_keycode], scancode_set[best_index].table,
sizeof(SDL_Scancode) * scancode_set[best_index].table_size);
} else {
SDL_Keycode keymap[SDL_NUM_SCANCODES];
printf
("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n");
/* Determine key_layout - only works on US QWERTY layout */
SDL_GetDefaultKeymap(keymap);
for (i = min_keycode; i <= max_keycode; ++i) {
KeySym sym;
sym = X11_KeyCodeToSym(_this, (KeyCode) i, 0);
if (sym != NoSymbol) {
SDL_Scancode scancode;
printf("code = %d, sym = 0x%X (%s) ", i - min_keycode,
(unsigned int) sym, X11_XKeysymToString(sym));
scancode = X11_KeyCodeToSDLScancode(_this, i);
data->key_layout[i] = scancode;
if (scancode == SDL_SCANCODE_UNKNOWN) {
printf("scancode not found\n");
} else {
printf("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode));
}
}
}
}
X11_UpdateKeymap(_this);
SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
#ifdef SDL_USE_IME
SDL_IME_Init();
#endif
return 0;
}
void
X11_UpdateKeymap(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
int i;
SDL_Scancode scancode;
SDL_Keycode keymap[SDL_NUM_SCANCODES];
unsigned char group = 0;
SDL_GetDefaultKeymap(keymap);
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
if (data->xkb) {
XkbStateRec state;
X11_XkbGetUpdatedMap(data->display, XkbAllClientInfoMask, data->xkb);
if (X11_XkbGetState(data->display, XkbUseCoreKbd, &state) == Success) {
group = state.group;
}
}
#endif
for (i = 0; i < SDL_arraysize(data->key_layout); i++) {
Uint32 key;
/* Make sure this is a valid scancode */
scancode = data->key_layout[i];
if (scancode == SDL_SCANCODE_UNKNOWN) {
continue;
}
/* See if there is a UCS keycode for this scancode */
key = X11_KeyCodeToUcs4(_this, (KeyCode)i, group);
if (key) {
keymap[scancode] = key;
} else {
SDL_Scancode keyScancode = X11_KeyCodeToSDLScancode(_this, (KeyCode)i);
switch (keyScancode) {
case SDL_SCANCODE_RETURN:
keymap[scancode] = SDLK_RETURN;
break;
case SDL_SCANCODE_ESCAPE:
keymap[scancode] = SDLK_ESCAPE;
break;
case SDL_SCANCODE_BACKSPACE:
keymap[scancode] = SDLK_BACKSPACE;
break;
case SDL_SCANCODE_TAB:
keymap[scancode] = SDLK_TAB;
break;
case SDL_SCANCODE_DELETE:
keymap[scancode] = SDLK_DELETE;
break;
default:
keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(keyScancode);
break;
}
}
}
SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
}
void
X11_QuitKeyboard(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
if (data->xkb) {
X11_XkbFreeKeyboard(data->xkb, 0, True);
data->xkb = NULL;
}
#endif
#ifdef SDL_USE_IME
SDL_IME_Quit();
#endif
}
static void
X11_ResetXIM(_THIS)
{
#ifdef X_HAVE_UTF8_STRING
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
int i;
if (videodata && videodata->windowlist) {
for (i = 0; i < videodata->numwindows; ++i) {
SDL_WindowData *data = videodata->windowlist[i];
if (data && data->ic) {
/* Clear any partially entered dead keys */
char *contents = X11_Xutf8ResetIC(data->ic);
if (contents) {
X11_XFree(contents);
}
}
}
}
#endif
}
void
X11_StartTextInput(_THIS)
{
X11_ResetXIM(_this);
}
void
X11_StopTextInput(_THIS)
{
X11_ResetXIM(_this);
#ifdef SDL_USE_IME
SDL_IME_Reset();
#endif
}
void
X11_SetTextInputRect(_THIS, SDL_Rect *rect)
{
if (!rect) {
SDL_InvalidParamError("rect");
return;
}
#ifdef SDL_USE_IME
SDL_IME_UpdateTextRect(rect);
#endif
}
#endif /* SDL_VIDEO_DRIVER_X11 */
/* vi: set ts=4 sw=4 expandtab: */
SDL_SCANCODE_KP_2
@ SDL_SCANCODE_KP_2
Definition: SDL_scancode.h:189
SDL_SCANCODE_RCTRL
@ SDL_SCANCODE_RCTRL
Definition: SDL_scancode.h:332
SDL_SCANCODE_PRINTSCREEN
@ SDL_SCANCODE_PRINTSCREEN
Definition: SDL_scancode.h:166
SDL_SCANCODE_BACKSLASH
@ SDL_SCANCODE_BACKSLASH
Definition: SDL_scancode.h:102
SDL_SCANCODE_HELP
@ SDL_SCANCODE_HELP
Definition: SDL_scancode.h:228
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_SCANCODE_KP_MINUS
@ SDL_SCANCODE_KP_MINUS
Definition: SDL_scancode.h:185
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:381
SDL_x11video.h
SDL_SCANCODE_LEFT
@ SDL_SCANCODE_LEFT
Definition: SDL_scancode.h:177
SDL_GetDefaultKeymap
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
Definition: SDL_keyboard.c:588
SDL_SCANCODE_PERIOD
@ SDL_SCANCODE_PERIOD
Definition: SDL_scancode.h:148
SDL_SCANCODE_F17
@ SDL_SCANCODE_F17
Definition: SDL_scancode.h:219
SDL_SCANCODE_F13
@ SDL_SCANCODE_F13
Definition: SDL_scancode.h:215
SDL_SCANCODE_SELECT
@ SDL_SCANCODE_SELECT
Definition: SDL_scancode.h:230
SDL_SCANCODE_AGAIN
@ SDL_SCANCODE_AGAIN
Definition: SDL_scancode.h:232
SDL_SCANCODE_F7
@ SDL_SCANCODE_F7
Definition: SDL_scancode.h:159
SDL_IME_Reset
void SDL_IME_Reset(void)
Definition: SDL_ime.c:123
SDL_SCANCODE_UNDO
@ SDL_SCANCODE_UNDO
Definition: SDL_scancode.h:233
NULL
#define NULL
Definition: begin_code.h:167
SDL_SCANCODE_KP_PERIOD
@ SDL_SCANCODE_KP_PERIOD
Definition: SDL_scancode.h:198
SDL_SetScancodeName
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
Definition: SDL_keyboard.c:616
SDL_SCANCODE_SLASH
@ SDL_SCANCODE_SLASH
Definition: SDL_scancode.h:149
SDL_SCANCODE_SCROLLLOCK
@ SDL_SCANCODE_SCROLLLOCK
Definition: SDL_scancode.h:167
SDL_SCANCODE_RIGHT
@ SDL_SCANCODE_RIGHT
Definition: SDL_scancode.h:176
SDL_WindowData
Definition: SDL_androidwindow.h:38
SDL_SCANCODE_F15
@ SDL_SCANCODE_F15
Definition: SDL_scancode.h:217
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_SCANCODE_KP_8
@ SDL_SCANCODE_KP_8
Definition: SDL_scancode.h:195
SDL_SCANCODE_FIND
@ SDL_SCANCODE_FIND
Definition: SDL_scancode.h:237
SDL_IME_Init
SDL_bool SDL_IME_Init(void)
Definition: SDL_ime.c:86
SDL_SCANCODE_UP
@ SDL_SCANCODE_UP
Definition: SDL_scancode.h:179
SDL_SCANCODE_KP_5
@ SDL_SCANCODE_KP_5
Definition: SDL_scancode.h:192
SDL_SCANCODE_TAB
@ SDL_SCANCODE_TAB
Definition: SDL_scancode.h:95
SDL_SCANCODE_GRAVE
@ SDL_SCANCODE_GRAVE
Definition: SDL_scancode.h:130
SDL_SCANCODE_EQUALS
@ SDL_SCANCODE_EQUALS
Definition: SDL_scancode.h:99
X11_QuitKeyboard
void X11_QuitKeyboard(_THIS)
SDL_SCANCODE_F3
@ SDL_SCANCODE_F3
Definition: SDL_scancode.h:155
SDL_SCANCODE_EXECUTE
@ SDL_SCANCODE_EXECUTE
Definition: SDL_scancode.h:227
SDL_SCANCODE_PAGEDOWN
@ SDL_SCANCODE_PAGEDOWN
Definition: SDL_scancode.h:175
X11_SetTextInputRect
void X11_SetTextInputRect(_THIS, SDL_Rect *rect)
SDL_VideoData::windowlist
SDL_WindowData ** windowlist
Definition: SDL_x11video.h:83
SDL_Keycode
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:45
SDL_SCANCODE_F18
@ SDL_SCANCODE_F18
Definition: SDL_scancode.h:220
X11_StartTextInput
void X11_StartTextInput(_THIS)
SDL_SCANCODE_KP_6
@ SDL_SCANCODE_KP_6
Definition: SDL_scancode.h:193
SDL_SCANCODE_LALT
@ SDL_SCANCODE_LALT
Definition: SDL_scancode.h:330
X11_KeySymToUcs4
unsigned int X11_KeySymToUcs4(KeySym keysym)
SDL_SCANCODE_KP_EQUALS
@ SDL_SCANCODE_KP_EQUALS
Definition: SDL_scancode.h:214
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_SCANCODE_KP_1
@ SDL_SCANCODE_KP_1
Definition: SDL_scancode.h:188
SDL_SCANCODE_F9
@ SDL_SCANCODE_F9
Definition: SDL_scancode.h:161
SDL_SCANCODE_CAPSLOCK
@ SDL_SCANCODE_CAPSLOCK
Definition: SDL_scancode.h:151
SDLK_ESCAPE
@ SDLK_ESCAPE
Definition: SDL_keycode.h:55
SDL_SCANCODE_STOP
@ SDL_SCANCODE_STOP
Definition: SDL_scancode.h:231
SDL_SCANCODE_F5
@ SDL_SCANCODE_F5
Definition: SDL_scancode.h:157
SDL_SCANCODE_RIGHTBRACKET
@ SDL_SCANCODE_RIGHTBRACKET
Definition: SDL_scancode.h:101
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_VideoData::numwindows
int numwindows
Definition: SDL_x11video.h:82
SDL_SCANCODE_F16
@ SDL_SCANCODE_F16
Definition: SDL_scancode.h:218
SDL_SCANCODE_MINUS
@ SDL_SCANCODE_MINUS
Definition: SDL_scancode.h:98
SDL_SCANCODE_KP_MULTIPLY
@ SDL_SCANCODE_KP_MULTIPLY
Definition: SDL_scancode.h:184
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:118
X11_UpdateKeymap
void X11_UpdateKeymap(_THIS)
SDL_SCANCODE_SPACE
@ SDL_SCANCODE_SPACE
Definition: SDL_scancode.h:96
xvnc_scancode_table
static const SDL_Scancode xvnc_scancode_table[]
Definition: scancodes_xfree86.h:426
SDL_SCANCODE_PAUSE
@ SDL_SCANCODE_PAUSE
Definition: SDL_scancode.h:168
SDL_SCANCODE_KP_7
@ SDL_SCANCODE_KP_7
Definition: SDL_scancode.h:194
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_SCANCODE_F24
@ SDL_SCANCODE_F24
Definition: SDL_scancode.h:226
SDL_SCANCODE_SYSREQ
@ SDL_SCANCODE_SYSREQ
Definition: SDL_scancode.h:269
group
GLboolean GLuint group
Definition: SDL_opengl_glext.h:4996
SDL_SCANCODE_A
@ SDL_SCANCODE_A
Definition: SDL_scancode.h:54
SDL_SCANCODE_F21
@ SDL_SCANCODE_F21
Definition: SDL_scancode.h:223
SDL_SCANCODE_KP_4
@ SDL_SCANCODE_KP_4
Definition: SDL_scancode.h:191
SDL_SCANCODE_KP_0
@ SDL_SCANCODE_KP_0
Definition: SDL_scancode.h:197
X11_KeyCodeToSym
KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group)
SDL_SCANCODE_TO_KEYCODE
#define SDL_SCANCODE_TO_KEYCODE(X)
Definition: SDL_keycode.h:48
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_SCANCODE_0
@ SDL_SCANCODE_0
Definition: SDL_scancode.h:90
SDL_SCANCODE_ESCAPE
@ SDL_SCANCODE_ESCAPE
Definition: SDL_scancode.h:93
SDL_SCANCODE_F14
@ SDL_SCANCODE_F14
Definition: SDL_scancode.h:216
SDL_SCANCODE_KP_9
@ SDL_SCANCODE_KP_9
Definition: SDL_scancode.h:196
SDL_SCANCODE_F20
@ SDL_SCANCODE_F20
Definition: SDL_scancode.h:222
SDL_SCANCODE_F11
@ SDL_SCANCODE_F11
Definition: SDL_scancode.h:163
key
GLuint64 key
Definition: gl2ext.h:2192
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_SCANCODE_BACKSPACE
@ SDL_SCANCODE_BACKSPACE
Definition: SDL_scancode.h:94
SDL_SCANCODE_KP_DIVIDE
@ SDL_SCANCODE_KP_DIVIDE
Definition: SDL_scancode.h:183
SDL_SCANCODE_KP_PLUS
@ SDL_SCANCODE_KP_PLUS
Definition: SDL_scancode.h:186
SDL_SCANCODE_LCTRL
@ SDL_SCANCODE_LCTRL
Definition: SDL_scancode.h:328
SDLK_BACKSPACE
@ SDLK_BACKSPACE
Definition: SDL_keycode.h:56
SDL_SCANCODE_KP_COMMA
@ SDL_SCANCODE_KP_COMMA
Definition: SDL_scancode.h:245
SDL_SetKeymap
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
Definition: SDL_keyboard.c:594
SDL_SCANCODE_UNKNOWN
@ SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
SDL_SCANCODE_LSHIFT
@ SDL_SCANCODE_LSHIFT
Definition: SDL_scancode.h:329
SDL_SCANCODE_LEFTBRACKET
@ SDL_SCANCODE_LEFTBRACKET
Definition: SDL_scancode.h:100
SDLK_DELETE
@ SDLK_DELETE
Definition: SDL_keycode.h:148
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
distance
GLsizei GLsizei GLfloat distance
Definition: SDL_opengl_glext.h:9200
X11_StopTextInput
void X11_StopTextInput(_THIS)
SDL_SCANCODE_DELETE
@ SDL_SCANCODE_DELETE
Definition: SDL_scancode.h:173
SDL_SCANCODE_F8
@ SDL_SCANCODE_F8
Definition: SDL_scancode.h:160
SDL_GetScancodeName
#define SDL_GetScancodeName
Definition: SDL_dynapi_overrides.h:222
SDLK_RETURN
@ SDLK_RETURN
Definition: SDL_keycode.h:54
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
xfree86_scancode_table
static const SDL_Scancode xfree86_scancode_table[]
Definition: scancodes_xfree86.h:32
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
Definition: SDL_config.h:358
SDL_IME_Quit
void SDL_IME_Quit(void)
Definition: SDL_ime.c:109
SDL_SCANCODE_COMMA
@ SDL_SCANCODE_COMMA
Definition: SDL_scancode.h:147
SDL_SCANCODE_APPLICATION
@ SDL_SCANCODE_APPLICATION
Definition: SDL_scancode.h:210
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:77
j
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 int in j)
Definition: SDL_x11sym.h:50
SDL_SCANCODE_F2
@ SDL_SCANCODE_F2
Definition: SDL_scancode.h:154
xfree86_scancode_table2
static const SDL_Scancode xfree86_scancode_table2[]
Definition: scancodes_xfree86.h:183
X11_InitKeyboard
int X11_InitKeyboard(_THIS)
SDLK_TAB
@ SDLK_TAB
Definition: SDL_keycode.h:57
SDL_SCANCODE_PAGEUP
@ SDL_SCANCODE_PAGEUP
Definition: SDL_scancode.h:172
SDL_SCANCODE_NUMLOCKCLEAR
@ SDL_SCANCODE_NUMLOCKCLEAR
Definition: SDL_scancode.h:181
SDL_SCANCODE_APOSTROPHE
@ SDL_SCANCODE_APOSTROPHE
Definition: SDL_scancode.h:129
SDL_SCANCODE_MODE
@ SDL_SCANCODE_MODE
Definition: SDL_scancode.h:337
SDL_IME_UpdateTextRect
void SDL_IME_UpdateTextRect(SDL_Rect *rect)
Definition: SDL_ime.c:139
SDL_SCANCODE_F23
@ SDL_SCANCODE_F23
Definition: SDL_scancode.h:225
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_SCANCODE_LGUI
@ SDL_SCANCODE_LGUI
Definition: SDL_scancode.h:331
SDL_NUM_SCANCODES
@ SDL_NUM_SCANCODES
Definition: SDL_scancode.h:407
SDL_SCANCODE_RGUI
@ SDL_SCANCODE_RGUI
Definition: SDL_scancode.h:335
SDL_SCANCODE_KP_3
@ SDL_SCANCODE_KP_3
Definition: SDL_scancode.h:190
SDL_SCANCODE_1
@ SDL_SCANCODE_1
Definition: SDL_scancode.h:81
SDL_SCANCODE_F19
@ SDL_SCANCODE_F19
Definition: SDL_scancode.h:221
SDL_SCANCODE_INSERT
@ SDL_SCANCODE_INSERT
Definition: SDL_scancode.h:169
SDL_SCANCODE_F22
@ SDL_SCANCODE_F22
Definition: SDL_scancode.h:224
SDL_SCANCODE_DOWN
@ SDL_SCANCODE_DOWN
Definition: SDL_scancode.h:178
SDL_SCANCODE_RALT
@ SDL_SCANCODE_RALT
Definition: SDL_scancode.h:334
SDL_SCANCODE_END
@ SDL_SCANCODE_END
Definition: SDL_scancode.h:174
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_SCANCODE_RSHIFT
@ SDL_SCANCODE_RSHIFT
Definition: SDL_scancode.h:333
SDL_SCANCODE_F1
@ SDL_SCANCODE_F1
Definition: SDL_scancode.h:153
SDL_SCANCODE_F6
@ SDL_SCANCODE_F6
Definition: SDL_scancode.h:158
state
struct xkb_state * state
Definition: SDL_waylandsym.h:113
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
table
GLenum GLsizei GLenum GLenum const void * table
Definition: SDL_opengl_glext.h:3118
darwin_scancode_table
static const SDL_Scancode darwin_scancode_table[]
Definition: scancodes_darwin.h:29
SDL_SCANCODE_F12
@ SDL_SCANCODE_F12
Definition: SDL_scancode.h:164
SDL_SCANCODE_MENU
@ SDL_SCANCODE_MENU
Definition: SDL_scancode.h:229
SDL_SCANCODE_HOME
@ SDL_SCANCODE_HOME
Definition: SDL_scancode.h:171
SDL_SCANCODE_RETURN
@ SDL_SCANCODE_RETURN
Definition: SDL_scancode.h:92
imKStoUCS.h
SDL_SCANCODE_F10
@ SDL_SCANCODE_F10
Definition: SDL_scancode.h:162
SDL_VideoData
Definition: SDL_androidvideo.h:36
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_SCANCODE_KP_ENTER
@ SDL_SCANCODE_KP_ENTER
Definition: SDL_scancode.h:187
SDL_SCANCODE_F4
@ SDL_SCANCODE_F4
Definition: SDL_scancode.h:156