From cceca2ac99dce6bb4123c41b98ad17900f073f01 Mon Sep 17 00:00:00 2001 From: Bill Lash Date: Sat, 15 Aug 2015 00:25:52 -0500 Subject: [PATCH] Additional patch to correct the number key assignments, and add assignments for keys that were missed --- src/video/x11/SDL_x11keyboard.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 2e80b73a9..d775b2c02 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -133,6 +133,17 @@ static const struct { { 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 @@ -162,12 +173,18 @@ X11_KeyCodeToSDLScancode(Display *display, KeyCode keycode) 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 && keysym <= XK_9) { - return SDL_SCANCODE_0 + (keysym - XK_0); + 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) {