# HG changeset patch # User Sam Lantinga # Date 1228278744 0 # Node ID 620a91b6d263adb3289c4abd994e374c1913bf70 # Parent 4dba7aa7ea774797c15369e89e7c80100ac3aa62 Date: Tue, 02 Dec 2008 23:38:26 +0100 From: Couriersud Subject: Re: SDL: Keyboard layout unknown I have attached a diff which will add an additional keyboard layout to the x11 driver. The issue arose, when I moved to ubuntu intrepid. I was only able to map the keys available on my keyboard. The differences to the existing keyboard was the mapping of HOME,UP,DOWN and some other keys. Now only one issue remains. Dead keys (e.g. ^, ` ') on european keyboards do not generate a "scancode" event. Just a text event when the key is composed (e.g. ?? ?? ??). diff -r 4dba7aa7ea77 -r 620a91b6d263 src/events/scancodes_xfree86.h --- a/src/events/scancodes_xfree86.h Tue Dec 02 17:14:04 2008 +0000 +++ b/src/events/scancodes_xfree86.h Wed Dec 03 04:32:24 2008 +0000 @@ -175,4 +175,156 @@ /* 145 */ SDL_SCANCODE_FIND, /* 146 */ SDL_SCANCODE_CUT, }; + +/* for wireless usb keyboard (manufacturer TRUST) without numpad. */ +static SDL_scancode xfree86_scancode_table2[] = { + /* 0 */ SDL_SCANCODE_UNKNOWN, + /* 1 */ SDL_SCANCODE_ESCAPE, + /* 2 */ SDL_SCANCODE_1, + /* 3 */ SDL_SCANCODE_2, + /* 4 */ SDL_SCANCODE_3, + /* 5 */ SDL_SCANCODE_4, + /* 6 */ SDL_SCANCODE_5, + /* 7 */ SDL_SCANCODE_6, + /* 8 */ SDL_SCANCODE_7, + /* 9 */ SDL_SCANCODE_8, + /* 10 */ SDL_SCANCODE_9, + /* 11 */ SDL_SCANCODE_0, + /* 12 */ SDL_SCANCODE_MINUS, + /* 13 */ SDL_SCANCODE_EQUALS, + /* 14 */ SDL_SCANCODE_BACKSPACE, + /* 15 */ SDL_SCANCODE_TAB, + /* 16 */ SDL_SCANCODE_Q, + /* 17 */ SDL_SCANCODE_W, + /* 18 */ SDL_SCANCODE_E, + /* 19 */ SDL_SCANCODE_R, + /* 20 */ SDL_SCANCODE_T, + /* 21 */ SDL_SCANCODE_Y, + /* 22 */ SDL_SCANCODE_U, + /* 23 */ SDL_SCANCODE_I, + /* 24 */ SDL_SCANCODE_O, + /* 25 */ SDL_SCANCODE_P, + /* 26 */ SDL_SCANCODE_LEFTBRACKET, + /* 27 */ SDL_SCANCODE_RIGHTBRACKET, + /* 28 */ SDL_SCANCODE_RETURN, + /* 29 */ SDL_SCANCODE_LCTRL, + /* 30 */ SDL_SCANCODE_A, + /* 31 */ SDL_SCANCODE_S, + /* 32 */ SDL_SCANCODE_D, + /* 33 */ SDL_SCANCODE_F, + /* 34 */ SDL_SCANCODE_G, + /* 35 */ SDL_SCANCODE_H, + /* 36 */ SDL_SCANCODE_J, + /* 37 */ SDL_SCANCODE_K, + /* 38 */ SDL_SCANCODE_L, + /* 39 */ SDL_SCANCODE_SEMICOLON, + /* 40 */ SDL_SCANCODE_APOSTROPHE, + /* 41 */ SDL_SCANCODE_GRAVE, + /* 42 */ SDL_SCANCODE_LSHIFT, + /* 43 */ SDL_SCANCODE_BACKSLASH, + /* 44 */ SDL_SCANCODE_Z, + /* 45 */ SDL_SCANCODE_X, + /* 46 */ SDL_SCANCODE_C, + /* 47 */ SDL_SCANCODE_V, + /* 48 */ SDL_SCANCODE_B, + /* 49 */ SDL_SCANCODE_N, + /* 50 */ SDL_SCANCODE_M, + /* 51 */ SDL_SCANCODE_COMMA, + /* 52 */ SDL_SCANCODE_PERIOD, + /* 53 */ SDL_SCANCODE_SLASH, + /* 54 */ SDL_SCANCODE_RSHIFT, + /* 55 */ SDL_SCANCODE_KP_MULTIPLY, + /* 56 */ SDL_SCANCODE_LALT, + /* 57 */ SDL_SCANCODE_SPACE, + /* 58 */ SDL_SCANCODE_CAPSLOCK, + /* 59 */ SDL_SCANCODE_F1, + /* 60 */ SDL_SCANCODE_F2, + /* 61 */ SDL_SCANCODE_F3, + /* 62 */ SDL_SCANCODE_F4, + /* 63 */ SDL_SCANCODE_F5, + /* 64 */ SDL_SCANCODE_F6, + /* 65 */ SDL_SCANCODE_F7, + /* 66 */ SDL_SCANCODE_F8, + /* 67 */ SDL_SCANCODE_F9, + /* 68 */ SDL_SCANCODE_F10, + /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, + /* 70 */ SDL_SCANCODE_SCROLLLOCK, + /* 71 */ SDL_SCANCODE_KP_7, + /* 72 */ SDL_SCANCODE_KP_8, + /* 73 */ SDL_SCANCODE_KP_9, + /* 74 */ SDL_SCANCODE_KP_MINUS, + /* 75 */ SDL_SCANCODE_KP_4, + /* 76 */ SDL_SCANCODE_KP_5, + /* 77 */ SDL_SCANCODE_KP_6, + /* 78 */ SDL_SCANCODE_KP_PLUS, + /* 79 */ SDL_SCANCODE_KP_1, + /* 80 */ SDL_SCANCODE_KP_2, + /* 81 */ SDL_SCANCODE_KP_3, + /* 82 */ SDL_SCANCODE_KP_0, + /* 83 */ SDL_SCANCODE_KP_PERIOD, + /* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */ + /* 85 */ SDL_SCANCODE_MODE, /* ???? */ + /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, + /* 87 */ SDL_SCANCODE_F11, + /* 88 */ SDL_SCANCODE_F12, + /* 89 */ SDL_SCANCODE_UNKNOWN, + /* 90 */ SDL_SCANCODE_UNKNOWN, + /* 91 */ SDL_SCANCODE_UNKNOWN, + /* 92 */ SDL_SCANCODE_UNKNOWN, + /* 93 */ SDL_SCANCODE_UNKNOWN, + /* 94 */ SDL_SCANCODE_UNKNOWN, + /* 95 */ SDL_SCANCODE_UNKNOWN, + /* 96 */ SDL_SCANCODE_UNKNOWN, + /* 97 */ SDL_SCANCODE_RCTRL, + /* 98 */ SDL_SCANCODE_KP_DIVIDE, + /* 99 */ SDL_SCANCODE_UNKNOWN, + /* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */ + /* 101 */ SDL_SCANCODE_UNKNOWN, + /* 102 */ SDL_SCANCODE_HOME, + /* 103 */ SDL_SCANCODE_UP, + /* 104 */ SDL_SCANCODE_PAGEUP, + /* 105 */ SDL_SCANCODE_LEFT, + /* 106 */ SDL_SCANCODE_RIGHT, + /* 107 */ SDL_SCANCODE_END, + /* 108 */ SDL_SCANCODE_DOWN, + /* 109 */ SDL_SCANCODE_PAGEDOWN, + /* 110 */ SDL_SCANCODE_INSERT, + /* 111 */ SDL_SCANCODE_DELETE, + /* 112 */ SDL_SCANCODE_UNKNOWN, + /* 113 */ SDL_SCANCODE_UNKNOWN, + /* 114 */ SDL_SCANCODE_UNKNOWN, + /* 115 */ SDL_SCANCODE_UNKNOWN, + /* 116 */ SDL_SCANCODE_UNKNOWN, + /* 117 */ SDL_SCANCODE_UNKNOWN, + /* 118 */ SDL_SCANCODE_UNKNOWN, + /* 119 */ SDL_SCANCODE_UNKNOWN, + /* 120 */ SDL_SCANCODE_UNKNOWN, + /* 121 */ SDL_SCANCODE_PAUSE, + /* 122 */ SDL_SCANCODE_UNKNOWN, + /* 123 */ SDL_SCANCODE_UNKNOWN, + /* 124 */ SDL_SCANCODE_UNKNOWN, + /* 125 */ SDL_SCANCODE_LGUI, + /* 126 */ SDL_SCANCODE_RGUI, + /* 127 */ SDL_SCANCODE_APPLICATION, + /* 128 */ SDL_SCANCODE_UNKNOWN, + /* 129 */ SDL_SCANCODE_UNKNOWN, + /* 130 */ SDL_SCANCODE_UNKNOWN, + /* 131 */ SDL_SCANCODE_UNKNOWN, + /* 132 */ SDL_SCANCODE_UNKNOWN, + /* 133 */ SDL_SCANCODE_UNKNOWN, + /* 134 */ SDL_SCANCODE_UNKNOWN, + /* 135 */ SDL_SCANCODE_UNKNOWN, + /* 136 */ SDL_SCANCODE_UNKNOWN, + /* 137 */ SDL_SCANCODE_UNKNOWN, + /* 138 */ SDL_SCANCODE_UNKNOWN, + /* 139 */ SDL_SCANCODE_UNKNOWN, + /* 140 */ SDL_SCANCODE_UNKNOWN, + /* 141 */ SDL_SCANCODE_UNKNOWN, + /* 142 */ SDL_SCANCODE_UNKNOWN, + /* 143 */ SDL_SCANCODE_UNKNOWN, + /* 144 */ SDL_SCANCODE_UNKNOWN, + /* 145 */ SDL_SCANCODE_UNKNOWN, + /* 146 */ SDL_SCANCODE_UNKNOWN, +}; + /* *INDENT-ON* */ diff -r 4dba7aa7ea77 -r 620a91b6d263 src/video/x11/SDL_x11keyboard.c --- a/src/video/x11/SDL_x11keyboard.c Tue Dec 02 17:14:04 2008 +0000 +++ b/src/video/x11/SDL_x11keyboard.c Wed Dec 03 04:32:24 2008 +0000 @@ -285,6 +285,7 @@ } 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) }, }; /* *INDENT-OFF* */