sdl2
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Mon, 25 Feb 2013 16:52:42 -0800
changeset 692291d157d9f283
parent 6921 9a29af9de577
child 6923 d3b709232670
sdl2
- change the windows scancode logic to use the scan code value in lparam rather than VK's to get a stable scancode value across different KB layouts
include/SDL_scancode.h
src/events/scancodes_windows.h
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowskeyboard.c
test/checkkeys.c
     1.1 --- a/include/SDL_scancode.h	Mon Feb 25 08:05:26 2013 -0800
     1.2 +++ b/include/SDL_scancode.h	Mon Feb 25 16:52:42 2013 -0800
     1.3 @@ -385,6 +385,9 @@
     1.4      SDL_SCANCODE_EJECT = 281,
     1.5      SDL_SCANCODE_SLEEP = 282,
     1.6      
     1.7 +	SDL_SCANCODE_APP1 = 283,
     1.8 +	SDL_SCANCODE_APP2 = 284,
     1.9 +
    1.10      /*@}*//*Walther keys*/
    1.11  
    1.12      /* Add any other keys here. */
     2.1 --- a/src/events/scancodes_windows.h	Mon Feb 25 08:05:26 2013 -0800
     2.2 +++ b/src/events/scancodes_windows.h	Mon Feb 25 16:52:42 2013 -0800
     2.3 @@ -25,262 +25,35 @@
     2.4     - msdn.microsoft.com
     2.5  */
     2.6  /* *INDENT-OFF* */
     2.7 -static const SDL_Scancode windows_scancode_table[] = {
     2.8 -    /*  0, 0x00 */      SDL_SCANCODE_UNKNOWN,
     2.9 -    /*  1, 0x01 */      SDL_SCANCODE_UNKNOWN,
    2.10 -    /*  2, 0x02 */      SDL_SCANCODE_UNKNOWN,
    2.11 -    /*  3, 0x03 */      SDL_SCANCODE_UNKNOWN,
    2.12 -    /*  4, 0x04 */      SDL_SCANCODE_UNKNOWN,
    2.13 -    /*  5, 0x05 */      SDL_SCANCODE_UNKNOWN,
    2.14 -    /*  6, 0x06 */      SDL_SCANCODE_UNKNOWN,
    2.15 -    /*  7, 0x07 */      SDL_SCANCODE_UNKNOWN,
    2.16 -    /*  8, 0x08 */      SDL_SCANCODE_BACKSPACE,
    2.17 -    /*  9, 0x09 */      SDL_SCANCODE_TAB,
    2.18 -    /*  10, 0x0a */     SDL_SCANCODE_KP_ENTER, /* Not a VKEY, SDL specific */
    2.19 -    /*  11, 0x0b */     SDL_SCANCODE_UNKNOWN,
    2.20 -    /*  12, 0x0c */     SDL_SCANCODE_CLEAR,
    2.21 -    /*  13, 0x0d */     SDL_SCANCODE_RETURN,
    2.22 -    /*  14, 0x0e */     SDL_SCANCODE_UNKNOWN,
    2.23 -    /*  15, 0x0f */     SDL_SCANCODE_UNKNOWN,
    2.24 -    /*  16, 0x10 */     SDL_SCANCODE_UNKNOWN,
    2.25 -    /*  17, 0x11 */     SDL_SCANCODE_UNKNOWN,
    2.26 -    /*  18, 0x12 */     SDL_SCANCODE_APPLICATION,
    2.27 -    /*  19, 0x13 */     SDL_SCANCODE_PAUSE,
    2.28 -    /*  20, 0x14 */     SDL_SCANCODE_CAPSLOCK,
    2.29 -    /*  21, 0x15 */     SDL_SCANCODE_UNKNOWN,
    2.30 -    /*  22, 0x16 */     SDL_SCANCODE_UNKNOWN,
    2.31 -    /*  23, 0x17 */     SDL_SCANCODE_UNKNOWN,
    2.32 -    /*  24, 0x18 */     SDL_SCANCODE_UNKNOWN,
    2.33 -    /*  25, 0x19 */     SDL_SCANCODE_UNKNOWN,
    2.34 -    /*  26, 0x1a */     SDL_SCANCODE_UNKNOWN,
    2.35 -    /*  27, 0x1b */     SDL_SCANCODE_ESCAPE,
    2.36 -    /*  28, 0x1c */     SDL_SCANCODE_UNKNOWN,
    2.37 -    /*  29, 0x1d */     SDL_SCANCODE_UNKNOWN,
    2.38 -    /*  30, 0x1e */     SDL_SCANCODE_UNKNOWN,
    2.39 -    /*  31, 0x1f */     SDL_SCANCODE_MODE,
    2.40 -    /*  32, 0x20 */     SDL_SCANCODE_SPACE,
    2.41 -    /*  33, 0x21 */     SDL_SCANCODE_PAGEUP,
    2.42 -    /*  34, 0x22 */     SDL_SCANCODE_PAGEDOWN,
    2.43 -    /*  35, 0x23 */     SDL_SCANCODE_END,
    2.44 -    /*  36, 0x24 */     SDL_SCANCODE_HOME,
    2.45 -    /*  37, 0x25 */     SDL_SCANCODE_LEFT,
    2.46 -    /*  38, 0x26 */     SDL_SCANCODE_UP,
    2.47 -    /*  39, 0x27 */     SDL_SCANCODE_RIGHT,
    2.48 -    /*  40, 0x28 */     SDL_SCANCODE_DOWN,
    2.49 -    /*  41, 0x29 */     SDL_SCANCODE_SELECT,
    2.50 -    /*  42, 0x2a */     SDL_SCANCODE_UNKNOWN, /* VK_PRINT */
    2.51 -    /*  43, 0x2b */     SDL_SCANCODE_EXECUTE,
    2.52 -    /*  44, 0x2c */     SDL_SCANCODE_PRINTSCREEN,
    2.53 -    /*  45, 0x2d */     SDL_SCANCODE_INSERT,
    2.54 -    /*  46, 0x2e */     SDL_SCANCODE_DELETE,
    2.55 -    /*  47, 0x2f */     SDL_SCANCODE_HELP,
    2.56 -    /*  48, 0x30 */     SDL_SCANCODE_0,
    2.57 -    /*  49, 0x31 */     SDL_SCANCODE_1,
    2.58 -    /*  50, 0x32 */     SDL_SCANCODE_2,
    2.59 -    /*  51, 0x33 */     SDL_SCANCODE_3,
    2.60 -    /*  52, 0x34 */     SDL_SCANCODE_4,
    2.61 -    /*  53, 0x35 */     SDL_SCANCODE_5,
    2.62 -    /*  54, 0x36 */     SDL_SCANCODE_6,
    2.63 -    /*  55, 0x37 */     SDL_SCANCODE_7,
    2.64 -    /*  56, 0x38 */     SDL_SCANCODE_8,
    2.65 -    /*  57, 0x39 */     SDL_SCANCODE_9,
    2.66 -    /*  58, 0x3a */     SDL_SCANCODE_UNKNOWN,
    2.67 -    /*  59, 0x3b */     SDL_SCANCODE_UNKNOWN,
    2.68 -    /*  60, 0x3c */     SDL_SCANCODE_UNKNOWN,
    2.69 -    /*  61, 0x3d */     SDL_SCANCODE_UNKNOWN,
    2.70 -    /*  62, 0x3e */     SDL_SCANCODE_UNKNOWN,
    2.71 -    /*  63, 0x3f */     SDL_SCANCODE_UNKNOWN,
    2.72 -    /*  64, 0x40 */     SDL_SCANCODE_UNKNOWN,
    2.73 -    /*  65, 0x41 */     SDL_SCANCODE_A,
    2.74 -    /*  66, 0x42 */     SDL_SCANCODE_B,
    2.75 -    /*  67, 0x43 */     SDL_SCANCODE_C,
    2.76 -    /*  68, 0x44 */     SDL_SCANCODE_D,
    2.77 -    /*  69, 0x45 */     SDL_SCANCODE_E,
    2.78 -    /*  70, 0x46 */     SDL_SCANCODE_F,
    2.79 -    /*  71, 0x47 */     SDL_SCANCODE_G,
    2.80 -    /*  72, 0x48 */     SDL_SCANCODE_H,
    2.81 -    /*  73, 0x49 */     SDL_SCANCODE_I,
    2.82 -    /*  74, 0x4a */     SDL_SCANCODE_J,
    2.83 -    /*  75, 0x4b */     SDL_SCANCODE_K,
    2.84 -    /*  76, 0x4c */     SDL_SCANCODE_L,
    2.85 -    /*  77, 0x4d */     SDL_SCANCODE_M,
    2.86 -    /*  78, 0x4e */     SDL_SCANCODE_N,
    2.87 -    /*  79, 0x4f */     SDL_SCANCODE_O,
    2.88 -    /*  80, 0x50 */     SDL_SCANCODE_P,
    2.89 -    /*  81, 0x51 */     SDL_SCANCODE_Q,
    2.90 -    /*  82, 0x52 */     SDL_SCANCODE_R,
    2.91 -    /*  83, 0x53 */     SDL_SCANCODE_S,
    2.92 -    /*  84, 0x54 */     SDL_SCANCODE_T,
    2.93 -    /*  85, 0x55 */     SDL_SCANCODE_U,
    2.94 -    /*  86, 0x56 */     SDL_SCANCODE_V,
    2.95 -    /*  87, 0x57 */     SDL_SCANCODE_W,
    2.96 -    /*  88, 0x58 */     SDL_SCANCODE_X,
    2.97 -    /*  89, 0x59 */     SDL_SCANCODE_Y,
    2.98 -    /*  90, 0x5a */     SDL_SCANCODE_Z,
    2.99 -    /*  91, 0x5b */     SDL_SCANCODE_LGUI,
   2.100 -    /*  92, 0x5c */     SDL_SCANCODE_RGUI,
   2.101 -    /*  93, 0x5d */     SDL_SCANCODE_APPLICATION,
   2.102 -    /*  94, 0x5e */     SDL_SCANCODE_UNKNOWN,
   2.103 -    /*  95, 0x5f */     SDL_SCANCODE_UNKNOWN,
   2.104 -    /*  96, 0x60 */     SDL_SCANCODE_KP_0,
   2.105 -    /*  97, 0x61 */     SDL_SCANCODE_KP_1,
   2.106 -    /*  98, 0x62 */     SDL_SCANCODE_KP_2,
   2.107 -    /*  99, 0x63 */     SDL_SCANCODE_KP_3,
   2.108 -    /*  100, 0x64 */    SDL_SCANCODE_KP_4,
   2.109 -    /*  101, 0x65 */    SDL_SCANCODE_KP_5,
   2.110 -    /*  102, 0x66 */    SDL_SCANCODE_KP_6,
   2.111 -    /*  103, 0x67 */    SDL_SCANCODE_KP_7,
   2.112 -    /*  104, 0x68 */    SDL_SCANCODE_KP_8,
   2.113 -    /*  105, 0x69 */    SDL_SCANCODE_KP_9,
   2.114 -    /*  106, 0x6a */    SDL_SCANCODE_KP_MULTIPLY,
   2.115 -    /*  107, 0x6b */    SDL_SCANCODE_KP_PLUS,
   2.116 -    /*  108, 0x6c */    SDL_SCANCODE_SEPARATOR,
   2.117 -    /*  109, 0x6d */    SDL_SCANCODE_KP_MINUS,
   2.118 -    /*  110, 0x6e */    SDL_SCANCODE_KP_DECIMAL,
   2.119 -    /*  111, 0x6f */    SDL_SCANCODE_KP_DIVIDE,
   2.120 -    /*  112, 0x70 */    SDL_SCANCODE_F1,
   2.121 -    /*  113, 0x71 */    SDL_SCANCODE_F2,
   2.122 -    /*  114, 0x72 */    SDL_SCANCODE_F3,
   2.123 -    /*  115, 0x73 */    SDL_SCANCODE_F4,
   2.124 -    /*  116, 0x74 */    SDL_SCANCODE_F5,
   2.125 -    /*  117, 0x75 */    SDL_SCANCODE_F6,
   2.126 -    /*  118, 0x76 */    SDL_SCANCODE_F7,
   2.127 -    /*  119, 0x77 */    SDL_SCANCODE_F8,
   2.128 -    /*  120, 0x78 */    SDL_SCANCODE_F9,
   2.129 -    /*  121, 0x79 */    SDL_SCANCODE_F10,
   2.130 -    /*  122, 0x7a */    SDL_SCANCODE_F11,
   2.131 -    /*  123, 0x7b */    SDL_SCANCODE_F12,
   2.132 -    /*  124, 0x7c */    SDL_SCANCODE_F13,
   2.133 -    /*  125, 0x7d */    SDL_SCANCODE_F14,
   2.134 -    /*  126, 0x7e */    SDL_SCANCODE_F15,
   2.135 -    /*  127, 0x7f */    SDL_SCANCODE_F16,
   2.136 -    /*  128, 0x80 */    SDL_SCANCODE_F17, /* or SDL_SCANCODE_AUDIONEXT */
   2.137 -    /*  129, 0x81 */    SDL_SCANCODE_F18, /* or SDL_SCANCODE_AUDIOPREV */
   2.138 -    /*  130, 0x82 */    SDL_SCANCODE_F19, /* or SDL_SCANCODE_AUDIOSTOP */
   2.139 -    /*  131, 0x83 */    SDL_SCANCODE_F20, /* or SDL_SCANCODE_AUDIOPLAY */
   2.140 -    /*  132, 0x84 */    SDL_SCANCODE_F21, /* or SDL_SCANCODE_MAIL */
   2.141 -    /*  133, 0x85 */    SDL_SCANCODE_F22, /* or SDL_SCANCODE_MEDIASELECT */
   2.142 -    /*  134, 0x86 */    SDL_SCANCODE_F23, /* or SDL_SCANCODE_WWW */
   2.143 -    /*  135, 0x87 */    SDL_SCANCODE_F24, /* or SDL_SCANCODE_CALCULATOR */
   2.144 -    /*  136, 0x88 */    SDL_SCANCODE_UNKNOWN,
   2.145 -    /*  137, 0x89 */    SDL_SCANCODE_UNKNOWN,
   2.146 -    /*  138, 0x8a */    SDL_SCANCODE_UNKNOWN,
   2.147 -    /*  139, 0x8b */    SDL_SCANCODE_UNKNOWN,
   2.148 -    /*  140, 0x8c */    SDL_SCANCODE_UNKNOWN,
   2.149 -    /*  141, 0x8d */    SDL_SCANCODE_UNKNOWN,
   2.150 -    /*  142, 0x8e */    SDL_SCANCODE_UNKNOWN,
   2.151 -    /*  143, 0x8f */    SDL_SCANCODE_UNKNOWN,
   2.152 -    /*  144, 0x90 */    SDL_SCANCODE_NUMLOCKCLEAR,
   2.153 -    /*  145, 0x91 */    SDL_SCANCODE_SCROLLLOCK,
   2.154 -    /*  146, 0x92 */    SDL_SCANCODE_KP_EQUALS,
   2.155 -    /*  147, 0x93 */    SDL_SCANCODE_UNKNOWN,
   2.156 -    /*  148, 0x94 */    SDL_SCANCODE_UNKNOWN,
   2.157 -    /*  149, 0x95 */    SDL_SCANCODE_UNKNOWN,
   2.158 -    /*  150, 0x96 */    SDL_SCANCODE_UNKNOWN,
   2.159 -    /*  151, 0x97 */    SDL_SCANCODE_UNKNOWN,
   2.160 -    /*  152, 0x98 */    SDL_SCANCODE_UNKNOWN,
   2.161 -    /*  153, 0x99 */    SDL_SCANCODE_UNKNOWN,
   2.162 -    /*  154, 0x9a */    SDL_SCANCODE_UNKNOWN,
   2.163 -    /*  155, 0x9b */    SDL_SCANCODE_UNKNOWN,
   2.164 -    /*  156, 0x9c */    SDL_SCANCODE_UNKNOWN,
   2.165 -    /*  157, 0x9d */    SDL_SCANCODE_UNKNOWN,
   2.166 -    /*  158, 0x9e */    SDL_SCANCODE_UNKNOWN,
   2.167 -    /*  159, 0x9f */    SDL_SCANCODE_UNKNOWN,
   2.168 -    /*  160, 0xa0 */    SDL_SCANCODE_LSHIFT,
   2.169 -    /*  161, 0xa1 */    SDL_SCANCODE_RSHIFT,
   2.170 -    /*  162, 0xa2 */    SDL_SCANCODE_LCTRL,
   2.171 -    /*  163, 0xa3 */    SDL_SCANCODE_RCTRL,
   2.172 -    /*  164, 0xa4 */    SDL_SCANCODE_LALT,
   2.173 -    /*  165, 0xa5 */    SDL_SCANCODE_RALT,
   2.174 -    /*  166, 0xa6 */    SDL_SCANCODE_AC_BACK,
   2.175 -    /*  167, 0xa7 */    SDL_SCANCODE_AC_FORWARD,
   2.176 -    /*  168, 0xa8 */    SDL_SCANCODE_AC_REFRESH,
   2.177 -    /*  169, 0xa9 */    SDL_SCANCODE_AC_STOP,
   2.178 -    /*  170, 0xaa */    SDL_SCANCODE_AC_SEARCH,
   2.179 -    /*  171, 0xab */    SDL_SCANCODE_AC_BOOKMARKS,
   2.180 -    /*  172, 0xac */    SDL_SCANCODE_AC_HOME,
   2.181 -    /*  173, 0xad */    SDL_SCANCODE_AUDIOMUTE,
   2.182 -    /*  174, 0xae */    SDL_SCANCODE_VOLUMEDOWN,
   2.183 -    /*  175, 0xaf */    SDL_SCANCODE_VOLUMEUP,
   2.184 -    /*  176, 0xb0 */    SDL_SCANCODE_AUDIONEXT,
   2.185 -    /*  177, 0xb1 */    SDL_SCANCODE_AUDIOPREV,
   2.186 -    /*  178, 0xb2 */    SDL_SCANCODE_AUDIOSTOP,
   2.187 -    /*  179, 0xb3 */    SDL_SCANCODE_AUDIOPLAY,
   2.188 -    /*  180, 0xb4 */    SDL_SCANCODE_MAIL,
   2.189 -    /*  181, 0xb5 */    SDL_SCANCODE_MEDIASELECT,
   2.190 -    /*  182, 0xb6 */    SDL_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP1 */
   2.191 -    /*  183, 0xb7 */    SDL_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP2 */
   2.192 -    /*  184, 0xb8 */    SDL_SCANCODE_UNKNOWN,
   2.193 -    /*  185, 0xb9 */    SDL_SCANCODE_UNKNOWN,
   2.194 -    /*  186, 0xba */    SDL_SCANCODE_SEMICOLON,
   2.195 -    /*  187, 0xbb */    SDL_SCANCODE_EQUALS,
   2.196 -    /*  188, 0xbc */    SDL_SCANCODE_COMMA,
   2.197 -    /*  189, 0xbd */    SDL_SCANCODE_MINUS,
   2.198 -    /*  190, 0xbe */    SDL_SCANCODE_PERIOD,
   2.199 -    /*  191, 0xbf */    SDL_SCANCODE_SLASH,
   2.200 -    /*  192, 0xc0 */    SDL_SCANCODE_GRAVE,
   2.201 -    /*  193, 0xc1 */    SDL_SCANCODE_UNKNOWN,
   2.202 -    /*  194, 0xc2 */    SDL_SCANCODE_UNKNOWN,
   2.203 -    /*  195, 0xc3 */    SDL_SCANCODE_UNKNOWN,
   2.204 -    /*  196, 0xc4 */    SDL_SCANCODE_UNKNOWN,
   2.205 -    /*  197, 0xc5 */    SDL_SCANCODE_UNKNOWN,
   2.206 -    /*  198, 0xc6 */    SDL_SCANCODE_UNKNOWN,
   2.207 -    /*  199, 0xc7 */    SDL_SCANCODE_UNKNOWN,
   2.208 -    /*  200, 0xc8 */    SDL_SCANCODE_UNKNOWN,
   2.209 -    /*  201, 0xc9 */    SDL_SCANCODE_UNKNOWN,
   2.210 -    /*  202, 0xca */    SDL_SCANCODE_UNKNOWN,
   2.211 -    /*  203, 0xcb */    SDL_SCANCODE_UNKNOWN,
   2.212 -    /*  204, 0xcc */    SDL_SCANCODE_UNKNOWN,
   2.213 -    /*  205, 0xcd */    SDL_SCANCODE_UNKNOWN,
   2.214 -    /*  206, 0xce */    SDL_SCANCODE_UNKNOWN,
   2.215 -    /*  207, 0xcf */    SDL_SCANCODE_UNKNOWN,
   2.216 -    /*  208, 0xd0 */    SDL_SCANCODE_UNKNOWN,
   2.217 -    /*  209, 0xd1 */    SDL_SCANCODE_UNKNOWN,
   2.218 -    /*  210, 0xd2 */    SDL_SCANCODE_UNKNOWN,
   2.219 -    /*  211, 0xd3 */    SDL_SCANCODE_UNKNOWN,
   2.220 -    /*  212, 0xd4 */    SDL_SCANCODE_UNKNOWN,
   2.221 -    /*  213, 0xd5 */    SDL_SCANCODE_UNKNOWN,
   2.222 -    /*  214, 0xd6 */    SDL_SCANCODE_UNKNOWN,
   2.223 -    /*  215, 0xd7 */    SDL_SCANCODE_UNKNOWN,
   2.224 -    /*  216, 0xd8 */    SDL_SCANCODE_UNKNOWN,
   2.225 -    /*  217, 0xd9 */    SDL_SCANCODE_UNKNOWN,
   2.226 -    /*  218, 0xda */    SDL_SCANCODE_UNKNOWN,
   2.227 -    /*  219, 0xdb */    SDL_SCANCODE_LEFTBRACKET,
   2.228 -    /*  220, 0xdc */    SDL_SCANCODE_BACKSLASH,
   2.229 -    /*  221, 0xdd */    SDL_SCANCODE_RIGHTBRACKET,
   2.230 -    /*  222, 0xde */    SDL_SCANCODE_APOSTROPHE,
   2.231 -    /*  223, 0xdf */    SDL_SCANCODE_UNKNOWN,
   2.232 -    /*  224, 0xe0 */    SDL_SCANCODE_UNKNOWN,
   2.233 -    /*  225, 0xe1 */    SDL_SCANCODE_UNKNOWN,
   2.234 -    /*  226, 0xe2 */    SDL_SCANCODE_NONUSBACKSLASH,
   2.235 -    /*  227, 0xe3 */    SDL_SCANCODE_UNKNOWN,
   2.236 -    /*  228, 0xe4 */    SDL_SCANCODE_UNKNOWN,
   2.237 -    /*  229, 0xe5 */    SDL_SCANCODE_UNKNOWN,
   2.238 -    /*  230, 0xe6 */    SDL_SCANCODE_UNKNOWN,
   2.239 -    /*  231, 0xe7 */    SDL_SCANCODE_UNKNOWN,
   2.240 -    /*  232, 0xe8 */    SDL_SCANCODE_UNKNOWN,
   2.241 -    /*  233, 0xe9 */    SDL_SCANCODE_UNKNOWN,
   2.242 -    /*  234, 0xea */    SDL_SCANCODE_UNKNOWN,
   2.243 -    /*  235, 0xeb */    SDL_SCANCODE_UNKNOWN,
   2.244 -    /*  236, 0xec */    SDL_SCANCODE_UNKNOWN,
   2.245 -    /*  237, 0xed */    SDL_SCANCODE_UNKNOWN,
   2.246 -    /*  238, 0xee */    SDL_SCANCODE_UNKNOWN,
   2.247 -    /*  239, 0xef */    SDL_SCANCODE_UNKNOWN,
   2.248 -    /*  240, 0xf0 */    SDL_SCANCODE_UNKNOWN,
   2.249 -    /*  241, 0xf1 */    SDL_SCANCODE_UNKNOWN,
   2.250 -    /*  242, 0xf2 */    SDL_SCANCODE_UNKNOWN,
   2.251 -    /*  243, 0xf3 */    SDL_SCANCODE_UNKNOWN,
   2.252 -    /*  244, 0xf4 */    SDL_SCANCODE_UNKNOWN,
   2.253 -    /*  245, 0xf5 */    SDL_SCANCODE_UNKNOWN,
   2.254 -    /*  246, 0xf6 */    SDL_SCANCODE_SYSREQ,
   2.255 -    /*  247, 0xf7 */    SDL_SCANCODE_CRSEL,
   2.256 -    /*  248, 0xf8 */    SDL_SCANCODE_EXSEL,
   2.257 -    /*  249, 0xf9 */    SDL_SCANCODE_UNKNOWN, /* VK_EREOF */
   2.258 -    /*  250, 0xfa */    SDL_SCANCODE_UNKNOWN, /* VK_PLAY */
   2.259 -    /*  251, 0xfb */    SDL_SCANCODE_UNKNOWN, /* VK_ZOOM */
   2.260 -    /*  252, 0xfc */    SDL_SCANCODE_UNKNOWN,
   2.261 -    /*  253, 0xfd */    SDL_SCANCODE_UNKNOWN, /* VK_PA1 */
   2.262 -    /*  254, 0xfe */    SDL_SCANCODE_CLEAR,
   2.263 -    /*  255, 0xff */    SDL_SCANCODE_UNKNOWN,
   2.264 +// this maps non-translated keyboard scan codes to engine key codes
   2.265 +// Google for 'Keyboard Scan Code Specification'
   2.266 +static const SDL_Scancode windows_scancode_table[] = 
   2.267 +{ 
   2.268 +	//	0						1							2						3						4							5							6						7 
   2.269 +	//	8						9							A						B						C							D							E						F 
   2.270 +	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_ESCAPE,		SDL_SCANCODE_1,			SDL_SCANCODE_2,				SDL_SCANCODE_3,			SDL_SCANCODE_4,				SDL_SCANCODE_5,			SDL_SCANCODE_6,			// 0
   2.271 +	SDL_SCANCODE_7,				SDL_SCANCODE_8,				SDL_SCANCODE_9,			SDL_SCANCODE_0,				SDL_SCANCODE_MINUS,		SDL_SCANCODE_EQUALS,		SDL_SCANCODE_BACKSPACE,	SDL_SCANCODE_TAB,		// 0 
   2.272 +
   2.273 +	SDL_SCANCODE_Q,				SDL_SCANCODE_W,			SDL_SCANCODE_E,				SDL_SCANCODE_R,				SDL_SCANCODE_T,			SDL_SCANCODE_Y,				SDL_SCANCODE_U,			SDL_SCANCODE_I,			// 1
   2.274 +	SDL_SCANCODE_O,				SDL_SCANCODE_P,			SDL_SCANCODE_LEFTBRACKET,	SDL_SCANCODE_RIGHTBRACKET,	SDL_SCANCODE_RETURN,	SDL_SCANCODE_LCTRL,			SDL_SCANCODE_A,			SDL_SCANCODE_S,			// 1 
   2.275 +
   2.276 +	SDL_SCANCODE_D,				SDL_SCANCODE_F,			SDL_SCANCODE_G,				SDL_SCANCODE_H,				SDL_SCANCODE_J,			SDL_SCANCODE_K,				SDL_SCANCODE_L,			SDL_SCANCODE_SEMICOLON,	// 2 
   2.277 +	SDL_SCANCODE_APOSTROPHE,	SDL_SCANCODE_GRAVE,		SDL_SCANCODE_LSHIFT,		SDL_SCANCODE_BACKSLASH,		SDL_SCANCODE_Z,			SDL_SCANCODE_X,				SDL_SCANCODE_C,			SDL_SCANCODE_V,			// 2 
   2.278 +
   2.279 +	SDL_SCANCODE_B,				SDL_SCANCODE_N,			SDL_SCANCODE_M,				SDL_SCANCODE_COMMA,			SDL_SCANCODE_PERIOD,	SDL_SCANCODE_SLASH,			SDL_SCANCODE_RSHIFT,	SDL_SCANCODE_PRINTSCREEN,// 3
   2.280 +	SDL_SCANCODE_LALT,			SDL_SCANCODE_SPACE,		SDL_SCANCODE_CAPSLOCK,		SDL_SCANCODE_F1,			SDL_SCANCODE_F2,		SDL_SCANCODE_F3,			SDL_SCANCODE_F4,		SDL_SCANCODE_F5,			// 3 
   2.281 +
   2.282 +	SDL_SCANCODE_F6,			SDL_SCANCODE_F7,		SDL_SCANCODE_F8,			SDL_SCANCODE_F9,			SDL_SCANCODE_F10,		SDL_SCANCODE_NUMLOCKCLEAR,	SDL_SCANCODE_SCROLLLOCK,SDL_SCANCODE_HOME,		// 4
   2.283 +	SDL_SCANCODE_UP,			SDL_SCANCODE_PAGEUP,	SDL_SCANCODE_KP_MINUS,		SDL_SCANCODE_LEFT,			SDL_SCANCODE_KP_5,		SDL_SCANCODE_RIGHT,			SDL_SCANCODE_KP_PLUS,	SDL_SCANCODE_END,		// 4 
   2.284 +
   2.285 +	SDL_SCANCODE_DOWN,			SDL_SCANCODE_PAGEDOWN,	SDL_SCANCODE_INSERT,		SDL_SCANCODE_DELETE,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_F11,		// 5
   2.286 +	SDL_SCANCODE_F12,			SDL_SCANCODE_PAUSE,		SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_LGUI,			SDL_SCANCODE_RGUI,		SDL_SCANCODE_APPLICATION,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		// 5
   2.287 +
   2.288 +	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		// 6
   2.289 +	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		// 6 
   2.290 +	
   2.291 +	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		// 7
   2.292 +	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN,		SDL_SCANCODE_UNKNOWN,	SDL_SCANCODE_UNKNOWN		// 7 
   2.293  };
   2.294 +
   2.295  /* *INDENT-ON* */
     3.1 --- a/src/video/windows/SDL_windowsevents.c	Mon Feb 25 08:05:26 2013 -0800
     3.2 +++ b/src/video/windows/SDL_windowsevents.c	Mon Feb 25 16:52:42 2013 -0800
     3.3 @@ -105,6 +105,126 @@
     3.4      return wParam;
     3.5  }
     3.6  
     3.7 +static SDL_Scancode 
     3.8 +WindowsScanCodeToSDLScanCode( int lParam, int wParam, const SDL_Scancode *key_map )
     3.9 +{
    3.10 +	SDL_Scancode code;
    3.11 +	char bIsExtended;
    3.12 +	int nScanCode = ( lParam >> 16 ) & 0xFF;
    3.13 +
    3.14 +	if ( nScanCode == 0 )
    3.15 +	{
    3.16 +		switch( wParam )
    3.17 +		{
    3.18 +		case VK_CLEAR: return SDL_SCANCODE_CLEAR;
    3.19 +		case VK_MODECHANGE: return SDL_SCANCODE_MODE;
    3.20 +		case VK_SELECT: return SDL_SCANCODE_SELECT;
    3.21 +		case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;
    3.22 +		case VK_HELP: return SDL_SCANCODE_HELP;
    3.23 +
    3.24 +		case VK_F13: return SDL_SCANCODE_F13;
    3.25 +		case VK_F14: return SDL_SCANCODE_F14;
    3.26 +		case VK_F15: return SDL_SCANCODE_F15;
    3.27 +		case VK_F16: return SDL_SCANCODE_F16;
    3.28 +		case VK_F17: return SDL_SCANCODE_F17;
    3.29 +		case VK_F18: return SDL_SCANCODE_F18;
    3.30 +		case VK_F19: return SDL_SCANCODE_F19;
    3.31 +		case VK_F20: return SDL_SCANCODE_F20;
    3.32 +		case VK_F21: return SDL_SCANCODE_F21;
    3.33 +		case VK_F22: return SDL_SCANCODE_F22;
    3.34 +		case VK_F23: return SDL_SCANCODE_F23;
    3.35 +		case VK_F24: return SDL_SCANCODE_F24;
    3.36 +
    3.37 +		case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS;
    3.38 +		case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK;
    3.39 +		case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD;
    3.40 +		case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH;
    3.41 +		case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP;
    3.42 +		case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH;
    3.43 +		case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS;
    3.44 +		case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME;
    3.45 +		case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE;
    3.46 +		case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN;
    3.47 +		case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP;
    3.48 +	
    3.49 +		case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT;
    3.50 +		case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV;
    3.51 +		case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP;
    3.52 +		case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY;
    3.53 +		case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL;
    3.54 +		case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT;
    3.55 +		
    3.56 +		case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH;
    3.57 +
    3.58 +		case VK_ATTN: return SDL_SCANCODE_SYSREQ;
    3.59 +		case VK_CRSEL: return SDL_SCANCODE_CRSEL;
    3.60 +		case VK_EXSEL: return SDL_SCANCODE_EXSEL;
    3.61 +		case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR;
    3.62 +
    3.63 +		case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1;
    3.64 +		case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2;
    3.65 +
    3.66 +		default: return SDL_SCANCODE_UNKNOWN;
    3.67 +		}
    3.68 +	}
    3.69 +
    3.70 +	if ( nScanCode > 127 )
    3.71 +		return SDL_SCANCODE_UNKNOWN;
    3.72 +
    3.73 +	code = key_map[nScanCode];
    3.74 +
    3.75 +	bIsExtended = ( lParam & ( 1 << 24 ) ) != 0;
    3.76 +	if ( !bIsExtended )
    3.77 +	{
    3.78 +		switch ( code )
    3.79 +		{
    3.80 +		case SDL_SCANCODE_HOME:
    3.81 +			return SDL_SCANCODE_KP_7;
    3.82 +		case SDL_SCANCODE_UP:
    3.83 +			return SDL_SCANCODE_KP_8;
    3.84 +		case SDL_SCANCODE_PAGEUP:
    3.85 +			return SDL_SCANCODE_KP_9;
    3.86 +		case SDL_SCANCODE_LEFT:
    3.87 +			return SDL_SCANCODE_KP_4;
    3.88 +		case SDL_SCANCODE_RIGHT:
    3.89 +			return SDL_SCANCODE_KP_6;
    3.90 +		case SDL_SCANCODE_END:
    3.91 +			return SDL_SCANCODE_KP_1;
    3.92 +		case SDL_SCANCODE_DOWN:
    3.93 +			return SDL_SCANCODE_KP_2;
    3.94 +		case SDL_SCANCODE_PAGEDOWN:
    3.95 +			return SDL_SCANCODE_KP_3;
    3.96 +		case SDL_SCANCODE_INSERT:
    3.97 +			return SDL_SCANCODE_KP_0;
    3.98 +		case SDL_SCANCODE_DELETE:
    3.99 +			return SDL_SCANCODE_KP_DECIMAL;
   3.100 +		case SDL_SCANCODE_PRINTSCREEN:
   3.101 +			return SDL_SCANCODE_KP_MULTIPLY;
   3.102 +		default:
   3.103 +			break;
   3.104 +		}
   3.105 +	}
   3.106 +	else
   3.107 +	{
   3.108 +		switch ( code )
   3.109 +		{
   3.110 +		case SDL_SCANCODE_RETURN:
   3.111 +			return SDL_SCANCODE_KP_ENTER;
   3.112 +		case SDL_SCANCODE_LALT:
   3.113 +			return SDL_SCANCODE_RALT;
   3.114 +		case SDL_SCANCODE_LCTRL:
   3.115 +			return SDL_SCANCODE_RCTRL;
   3.116 +		case SDL_SCANCODE_SLASH:
   3.117 +			return SDL_SCANCODE_KP_DIVIDE;
   3.118 +		case SDL_SCANCODE_CAPSLOCK:
   3.119 +			return SDL_SCANCODE_KP_PLUS;
   3.120 +		}
   3.121 +	}
   3.122 +
   3.123 +	return code;
   3.124 +}
   3.125 +
   3.126 +
   3.127  LRESULT CALLBACK
   3.128  WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   3.129  {
   3.130 @@ -311,6 +431,7 @@
   3.131      case WM_SYSKEYDOWN:
   3.132      case WM_KEYDOWN:
   3.133          {
   3.134 +			SDL_Scancode code;
   3.135              wParam = RemapVKEY(wParam, lParam);
   3.136              switch (wParam) {
   3.137              case VK_CONTROL:
   3.138 @@ -346,9 +467,9 @@
   3.139                      wParam = VK_ENTER;
   3.140                  break;
   3.141              }
   3.142 -            if (wParam < 256) {
   3.143 -                SDL_SendKeyboardKey(SDL_PRESSED,
   3.144 -                                    data->videodata->key_layout[wParam]);
   3.145 +			code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
   3.146 +			if ( code != SDL_SCANCODE_UNKNOWN ) {
   3.147 +                SDL_SendKeyboardKey(SDL_PRESSED, code );
   3.148              }
   3.149          }
   3.150          returnCode = 0;
   3.151 @@ -357,7 +478,8 @@
   3.152      case WM_SYSKEYUP:
   3.153      case WM_KEYUP:
   3.154          {
   3.155 -            wParam = RemapVKEY(wParam, lParam);
   3.156 +			SDL_Scancode code;
   3.157 +			wParam = RemapVKEY(wParam, lParam);
   3.158              switch (wParam) {
   3.159              case VK_CONTROL:
   3.160                  if (lParam & EXTENDED_KEYMASK)
   3.161 @@ -394,15 +516,15 @@
   3.162              }
   3.163  
   3.164              /* Windows only reports keyup for print screen */
   3.165 -            if (wParam == VK_SNAPSHOT
   3.166 -                && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
   3.167 -                SDL_RELEASED) {
   3.168 -                SDL_SendKeyboardKey(SDL_PRESSED,
   3.169 -                                    data->videodata->key_layout[wParam]);
   3.170 -            }
   3.171 -            if (wParam < 256) {
   3.172 -                SDL_SendKeyboardKey(SDL_RELEASED,
   3.173 -                                    data->videodata->key_layout[wParam]);
   3.174 +			code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
   3.175 +			if ( code != SDL_SCANCODE_UNKNOWN ) {
   3.176 +				if (wParam == VK_SNAPSHOT
   3.177 +				    && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
   3.178 +				    SDL_RELEASED) {
   3.179 +				    SDL_SendKeyboardKey(SDL_PRESSED,
   3.180 +				                         code);
   3.181 +				}
   3.182 +                SDL_SendKeyboardKey(SDL_RELEASED, code );
   3.183              }
   3.184          }
   3.185          returnCode = 0;
     4.1 --- a/src/video/windows/SDL_windowskeyboard.c	Mon Feb 25 08:05:26 2013 -0800
     4.2 +++ b/src/video/windows/SDL_windowskeyboard.c	Mon Feb 25 16:52:42 2013 -0800
     4.3 @@ -90,6 +90,7 @@
     4.4          }
     4.5      }
     4.6  
     4.7 +	// windows scancode to SDL scancode table
     4.8      data->key_layout = windows_scancode_table;
     4.9  
    4.10      data->ime_com_initialized = SDL_FALSE;
    4.11 @@ -150,24 +151,28 @@
    4.12      SDL_Scancode scancode;
    4.13      SDL_Keycode keymap[SDL_NUM_SCANCODES];
    4.14  
    4.15 -    SDL_GetDefaultKeymap(keymap);
    4.16 +	for (i = 0; i < SDL_arraysize(keymap); ++i)
    4.17 +	{
    4.18 +		keymap[i] = SDL_SCANCODE_TO_KEYCODE( i );
    4.19 +	}
    4.20  
    4.21      for (i = 0; i < SDL_arraysize(windows_scancode_table); i++) {
    4.22 -
    4.23 +		int vk;
    4.24          /* Make sure this scancode is a valid character scancode */
    4.25          scancode = windows_scancode_table[i];
    4.26 -        if (scancode == SDL_SCANCODE_UNKNOWN || keymap[scancode] >= 127) {
    4.27 +        if (scancode == SDL_SCANCODE_UNKNOWN ) {
    4.28              continue;
    4.29          }
    4.30  
    4.31 -        /* Alphabetic keys are handled specially, since Windows remaps them */
    4.32 -        if (i >= 'A' && i <= 'Z') {
    4.33 -            BYTE vsc = alpha_scancodes[i - 'A'];
    4.34 -            keymap[scancode] = MapVirtualKey(vsc, MAPVK_VSC_TO_VK) + 0x20;
    4.35 -        } else {
    4.36 -            keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF);
    4.37 -        }
    4.38 +		vk =  MapVirtualKey(i, MAPVK_VSC_TO_VK);
    4.39 +		if ( vk ) {
    4.40 +			int ch;
    4.41 +			ch = (MapVirtualKey( vk, MAPVK_VK_TO_CHAR ) & 0x7FFF);
    4.42 +			 if ( ch )
    4.43 +				 keymap[scancode] = ch;
    4.44 +		}
    4.45      }
    4.46 +
    4.47      SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
    4.48  }
    4.49  
     5.1 --- a/test/checkkeys.c	Mon Feb 25 08:05:26 2013 -0800
     5.2 +++ b/test/checkkeys.c	Mon Feb 25 16:52:42 2013 -0800
     5.3 @@ -105,7 +105,7 @@
     5.4                  "Unknown Key (scancode %d = %s) %s ",
     5.5                  sym->scancode,
     5.6                  SDL_GetScancodeName(sym->scancode),
     5.7 -                pressed ? "pressed" : "released");
     5.8 +                pressed ? "pressed " : "released");
     5.9      }
    5.10  
    5.11      /* Print the translated character, if one exists */
    5.12 @@ -129,13 +129,13 @@
    5.13      if (repeat) {
    5.14          print_string(&spot, &left, " (repeat)");
    5.15      }
    5.16 -    SDL_Log("%s", message);
    5.17 +    SDL_Log("%s\n", message);
    5.18  }
    5.19  
    5.20  static void
    5.21  PrintText(char *text)
    5.22  {
    5.23 -    SDL_Log("Text: %s", text);
    5.24 +    SDL_Log("Text: %s\n", text);
    5.25  }
    5.26  
    5.27  int