Untested Win32 keyboard scancode code.
authorSam Lantinga <slouken@libsdl.org>
Fri, 08 Feb 2008 08:35:49 +0000
changeset 2308514f7c1651fc
parent 2307 47f8a579cd9b
child 2309 21591ae7355d
Untested Win32 keyboard scancode code.
src/events/scancodes_darwin.h
src/events/scancodes_win32.h
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32keyboard.c
src/video/win32/SDL_win32keyboard.h
src/video/win32/SDL_win32video.h
src/video/x11/SDL_x11keyboard.c
     1.1 --- a/src/events/scancodes_darwin.h	Thu Feb 07 16:14:43 2008 +0000
     1.2 +++ b/src/events/scancodes_darwin.h	Fri Feb 08 08:35:49 2008 +0000
     1.3 @@ -20,7 +20,7 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/* Mac virtual key code to SDLKey mapping table
     1.8 +/* Mac virtual key code to SDL scancode mapping table
     1.9     Sources:
    1.10     - Inside Macintosh: Text <http://developer.apple.com/documentation/mac/Text/Text-571.html>
    1.11     - Apple USB keyboard driver source <http://darwinsource.opendarwin.org/10.4.6.ppc/IOHIDFamily-172.8/IOHIDFamily/Cosmo_USB2ADB.c>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/events/scancodes_win32.h	Fri Feb 08 08:35:49 2008 +0000
     2.3 @@ -0,0 +1,287 @@
     2.4 +/*
     2.5 +    SDL - Simple DirectMedia Layer
     2.6 +    Copyright (C) 1997-2006 Sam Lantinga
     2.7 +
     2.8 +    This library is free software; you can redistribute it and/or
     2.9 +    modify it under the terms of the GNU Lesser General Public
    2.10 +    License as published by the Free Software Foundation; either
    2.11 +    version 2.1 of the License, or (at your option) any later version.
    2.12 +
    2.13 +    This library is distributed in the hope that it will be useful,
    2.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.16 +    Lesser General Public License for more details.
    2.17 +
    2.18 +    You should have received a copy of the GNU Lesser General Public
    2.19 +    License along with this library; if not, write to the Free Software
    2.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2.21 +
    2.22 +    Sam Lantinga
    2.23 +    slouken@libsdl.org
    2.24 +*/
    2.25 +#include "../../include/SDL_scancode.h"
    2.26 +
    2.27 +/* Win32 virtual key code to SDL scancode mapping table
    2.28 +   Sources:
    2.29 +   - msdn.microsoft.com
    2.30 +*/
    2.31 +/* *INDENT-OFF* */
    2.32 +static SDL_scancode win32_scancode_table[] = {
    2.33 +    /*  0, 0x00 */      SDL_SCANCODE_UNKNOWN,
    2.34 +    /*  1, 0x01 */      SDL_SCANCODE_UNKNOWN,
    2.35 +    /*  2, 0x02 */      SDL_SCANCODE_UNKNOWN,
    2.36 +    /*  3, 0x03 */      SDL_SCANCODE_UNKNOWN,
    2.37 +    /*  4, 0x04 */      SDL_SCANCODE_UNKNOWN,
    2.38 +    /*  5, 0x05 */      SDL_SCANCODE_UNKNOWN,
    2.39 +    /*  6, 0x06 */      SDL_SCANCODE_UNKNOWN,
    2.40 +    /*  7, 0x07 */      SDL_SCANCODE_UNKNOWN,
    2.41 +    /*  8, 0x08 */      SDL_SCANCODE_BACKSPACE,
    2.42 +    /*  9, 0x09 */      SDL_SCANCODE_TAB,
    2.43 +    /*  10, 0x0a */     SDL_SCANCODE_UNKNOWN,
    2.44 +    /*  11, 0x0b */     SDL_SCANCODE_UNKNOWN,
    2.45 +    /*  12, 0x0c */     SDL_SCANCODE_CLEAR,
    2.46 +    /*  13, 0x0d */     SDL_SCANCODE_RETURN,
    2.47 +    /*  14, 0x0e */     SDL_SCANCODE_UNKNOWN,
    2.48 +    /*  15, 0x0f */     SDL_SCANCODE_UNKNOWN,
    2.49 +    /*  16, 0x10 */     SDL_SCANCODE_UNKNOWN,
    2.50 +    /*  17, 0x11 */     SDL_SCANCODE_UNKNOWN,
    2.51 +    /*  18, 0x12 */     SDL_SCANCODE_APPLICATION,
    2.52 +    /*  19, 0x13 */     SDL_SCANCODE_PAUSE,
    2.53 +    /*  20, 0x14 */     SDL_SCANCODE_CAPSLOCK,
    2.54 +    /*  21, 0x15 */     SDL_SCANCODE_UNKNOWN,
    2.55 +    /*  22, 0x16 */     SDL_SCANCODE_UNKNOWN,
    2.56 +    /*  23, 0x17 */     SDL_SCANCODE_UNKNOWN,
    2.57 +    /*  24, 0x18 */     SDL_SCANCODE_UNKNOWN,
    2.58 +    /*  25, 0x19 */     SDL_SCANCODE_UNKNOWN,
    2.59 +    /*  26, 0x1a */     SDL_SCANCODE_UNKNOWN,
    2.60 +    /*  27, 0x1b */     SDL_SCANCODE_ESCAPE,
    2.61 +    /*  28, 0x1c */     SDL_SCANCODE_UNKNOWN,
    2.62 +    /*  29, 0x1d */     SDL_SCANCODE_UNKNOWN,
    2.63 +    /*  30, 0x1e */     SDL_SCANCODE_UNKNOWN,
    2.64 +    /*  31, 0x1f */     SDL_SCANCODE_MODE,
    2.65 +    /*  32, 0x20 */     SDL_SCANCODE_SPACE,
    2.66 +    /*  33, 0x21 */     SDL_SCANCODE_PAGEUP,
    2.67 +    /*  34, 0x22 */     SDL_SCANCODE_PAGEDOWN,
    2.68 +    /*  35, 0x23 */     SDL_SCANCODE_END,
    2.69 +    /*  36, 0x24 */     SDL_SCANCODE_HOME,
    2.70 +    /*  37, 0x25 */     SDL_SCANCODE_LEFT,
    2.71 +    /*  38, 0x26 */     SDL_SCANCODE_UP,
    2.72 +    /*  39, 0x27 */     SDL_SCANCODE_RIGHT,
    2.73 +    /*  40, 0x28 */     SDL_SCANCODE_DOWN,
    2.74 +    /*  41, 0x29 */     SDL_SCANCODE_SELECT,
    2.75 +    /*  42, 0x2a */     SDL_SCANCODE_UNKNOWN, /* VK_PRINT */
    2.76 +    /*  43, 0x2b */     SDL_SCANCODE_EXECUTE,
    2.77 +    /*  44, 0x2c */     SDL_SCANCODE_PRINTSCREEN,
    2.78 +    /*  45, 0x2d */     SDL_SCANCODE_INSERT,
    2.79 +    /*  46, 0x2e */     SDL_SCANCODE_DELETE,
    2.80 +    /*  47, 0x2f */     SDL_SCANCODE_HELP,
    2.81 +    /*  48, 0x30 */     SDL_SCANCODE_0,
    2.82 +    /*  49, 0x31 */     SDL_SCANCODE_1,
    2.83 +    /*  50, 0x32 */     SDL_SCANCODE_2,
    2.84 +    /*  51, 0x33 */     SDL_SCANCODE_3,
    2.85 +    /*  52, 0x34 */     SDL_SCANCODE_4,
    2.86 +    /*  53, 0x35 */     SDL_SCANCODE_5,
    2.87 +    /*  54, 0x36 */     SDL_SCANCODE_6,
    2.88 +    /*  55, 0x37 */     SDL_SCANCODE_7,
    2.89 +    /*  56, 0x38 */     SDL_SCANCODE_8,
    2.90 +    /*  57, 0x39 */     SDL_SCANCODE_9,
    2.91 +    /*  58, 0x3a */     SDL_SCANCODE_UNKNOWN,
    2.92 +    /*  59, 0x3b */     SDL_SCANCODE_UNKNOWN,
    2.93 +    /*  60, 0x3c */     SDL_SCANCODE_UNKNOWN,
    2.94 +    /*  61, 0x3d */     SDL_SCANCODE_UNKNOWN,
    2.95 +    /*  62, 0x3e */     SDL_SCANCODE_UNKNOWN,
    2.96 +    /*  63, 0x3f */     SDL_SCANCODE_UNKNOWN,
    2.97 +    /*  64, 0x40 */     SDL_SCANCODE_UNKNOWN,
    2.98 +    /*  65, 0x41 */     SDL_SCANCODE_A,
    2.99 +    /*  66, 0x42 */     SDL_SCANCODE_B,
   2.100 +    /*  67, 0x43 */     SDL_SCANCODE_C,
   2.101 +    /*  68, 0x44 */     SDL_SCANCODE_D,
   2.102 +    /*  69, 0x45 */     SDL_SCANCODE_E,
   2.103 +    /*  70, 0x46 */     SDL_SCANCODE_F,
   2.104 +    /*  71, 0x47 */     SDL_SCANCODE_G,
   2.105 +    /*  72, 0x48 */     SDL_SCANCODE_H,
   2.106 +    /*  73, 0x49 */     SDL_SCANCODE_I,
   2.107 +    /*  74, 0x4a */     SDL_SCANCODE_J,
   2.108 +    /*  75, 0x4b */     SDL_SCANCODE_K,
   2.109 +    /*  76, 0x4c */     SDL_SCANCODE_L,
   2.110 +    /*  77, 0x4d */     SDL_SCANCODE_M,
   2.111 +    /*  78, 0x4e */     SDL_SCANCODE_N,
   2.112 +    /*  79, 0x4f */     SDL_SCANCODE_O,
   2.113 +    /*  80, 0x50 */     SDL_SCANCODE_P,
   2.114 +    /*  81, 0x51 */     SDL_SCANCODE_Q,
   2.115 +    /*  82, 0x52 */     SDL_SCANCODE_R,
   2.116 +    /*  83, 0x53 */     SDL_SCANCODE_S,
   2.117 +    /*  84, 0x54 */     SDL_SCANCODE_T,
   2.118 +    /*  85, 0x55 */     SDL_SCANCODE_U,
   2.119 +    /*  86, 0x56 */     SDL_SCANCODE_V,
   2.120 +    /*  87, 0x57 */     SDL_SCANCODE_W,
   2.121 +    /*  88, 0x58 */     SDL_SCANCODE_X,
   2.122 +    /*  89, 0x59 */     SDL_SCANCODE_Y,
   2.123 +    /*  90, 0x5a */     SDL_SCANCODE_Z,
   2.124 +    /*  91, 0x5b */     SDL_SCANCODE_LGUI,
   2.125 +    /*  92, 0x5c */     SDL_SCANCODE_RGUI,
   2.126 +    /*  93, 0x5d */     SDL_SCANCODE_APPLICATION,
   2.127 +    /*  94, 0x5e */     SDL_SCANCODE_UNKNOWN,
   2.128 +    /*  95, 0x5f */     SDL_SCANCODE_UNKNOWN,
   2.129 +    /*  96, 0x60 */     SDL_SCANCODE_KP_0,
   2.130 +    /*  97, 0x61 */     SDL_SCANCODE_KP_1,
   2.131 +    /*  98, 0x62 */     SDL_SCANCODE_KP_2,
   2.132 +    /*  99, 0x63 */     SDL_SCANCODE_KP_3,
   2.133 +    /*  100, 0x64 */    SDL_SCANCODE_KP_4,
   2.134 +    /*  101, 0x65 */    SDL_SCANCODE_KP_5,
   2.135 +    /*  102, 0x66 */    SDL_SCANCODE_KP_6,
   2.136 +    /*  103, 0x67 */    SDL_SCANCODE_KP_7,
   2.137 +    /*  104, 0x68 */    SDL_SCANCODE_KP_8,
   2.138 +    /*  105, 0x69 */    SDL_SCANCODE_KP_9,
   2.139 +    /*  106, 0x6a */    SDL_SCANCODE_KP_MULTIPLY,
   2.140 +    /*  107, 0x6b */    SDL_SCANCODE_KP_PLUS,
   2.141 +    /*  108, 0x6c */    SDL_SCANCODE_SEPARATOR,
   2.142 +    /*  109, 0x6d */    SDL_SCANCODE_KP_MINUS,
   2.143 +    /*  110, 0x6e */    SDL_SCANCODE_KP_DECIMAL,
   2.144 +    /*  111, 0x6f */    SDL_SCANCODE_KP_DIVIDE,
   2.145 +    /*  112, 0x70 */    SDL_SCANCODE_F1,
   2.146 +    /*  113, 0x71 */    SDL_SCANCODE_F2,
   2.147 +    /*  114, 0x72 */    SDL_SCANCODE_F3,
   2.148 +    /*  115, 0x73 */    SDL_SCANCODE_F4,
   2.149 +    /*  116, 0x74 */    SDL_SCANCODE_F5,
   2.150 +    /*  117, 0x75 */    SDL_SCANCODE_F6,
   2.151 +    /*  118, 0x76 */    SDL_SCANCODE_F7,
   2.152 +    /*  119, 0x77 */    SDL_SCANCODE_F8,
   2.153 +    /*  120, 0x78 */    SDL_SCANCODE_F9,
   2.154 +    /*  121, 0x79 */    SDL_SCANCODE_F10,
   2.155 +    /*  122, 0x7a */    SDL_SCANCODE_F11,
   2.156 +    /*  123, 0x7b */    SDL_SCANCODE_F12,
   2.157 +    /*  124, 0x7c */    SDL_SCANCODE_F13,
   2.158 +    /*  125, 0x7d */    SDL_SCANCODE_F14,
   2.159 +    /*  126, 0x7e */    SDL_SCANCODE_F15,
   2.160 +    /*  127, 0x7f */    SDL_SCANCODE_F16,
   2.161 +    /*  128, 0x80 */    SDL_SCANCODE_F17, /* or SDL_SCANCODE_AUDIONEXT */
   2.162 +    /*  129, 0x81 */    SDL_SCANCODE_F18, /* or SDL_SCANCODE_AUDIOPREV */
   2.163 +    /*  130, 0x82 */    SDL_SCANCODE_F19, /* or SDL_SCANCODE_AUDIOSTOP */
   2.164 +    /*  131, 0x83 */    SDL_SCANCODE_F20, /* or SDL_SCANCODE_AUDIOPLAY */
   2.165 +    /*  132, 0x84 */    SDL_SCANCODE_F21, /* or SDL_SCANCODE_MAIL */
   2.166 +    /*  133, 0x85 */    SDL_SCANCODE_F22, /* or SDL_SCANCODE_MEDIASELECT */
   2.167 +    /*  134, 0x86 */    SDL_SCANCODE_F23, /* or SDL_SCANCODE_WWW */
   2.168 +    /*  135, 0x87 */    SDL_SCANCODE_F24, /* or SDL_SCANCODE_CALCULATOR */
   2.169 +    /*  136, 0x88 */    SDL_SCANCODE_UNKNOWN,
   2.170 +    /*  137, 0x89 */    SDL_SCANCODE_UNKNOWN,
   2.171 +    /*  138, 0x8a */    SDL_SCANCODE_UNKNOWN,
   2.172 +    /*  139, 0x8b */    SDL_SCANCODE_UNKNOWN,
   2.173 +    /*  140, 0x8c */    SDL_SCANCODE_UNKNOWN,
   2.174 +    /*  141, 0x8d */    SDL_SCANCODE_UNKNOWN,
   2.175 +    /*  142, 0x8e */    SDL_SCANCODE_UNKNOWN,
   2.176 +    /*  143, 0x8f */    SDL_SCANCODE_UNKNOWN,
   2.177 +    /*  144, 0x90 */    SDL_SCANCODE_NUMLOCKCLEAR,
   2.178 +    /*  145, 0x91 */    SDL_SCANCODE_SCROLLLOCK,
   2.179 +    /*  146, 0x92 */    SDL_SCANCODE_KP_EQUALS,
   2.180 +    /*  147, 0x93 */    SDL_SCANCODE_UNKNOWN,
   2.181 +    /*  148, 0x94 */    SDL_SCANCODE_UNKNOWN,
   2.182 +    /*  149, 0x95 */    SDL_SCANCODE_UNKNOWN,
   2.183 +    /*  150, 0x96 */    SDL_SCANCODE_UNKNOWN,
   2.184 +    /*  151, 0x97 */    SDL_SCANCODE_UNKNOWN,
   2.185 +    /*  152, 0x98 */    SDL_SCANCODE_UNKNOWN,
   2.186 +    /*  153, 0x99 */    SDL_SCANCODE_UNKNOWN,
   2.187 +    /*  154, 0x9a */    SDL_SCANCODE_UNKNOWN,
   2.188 +    /*  155, 0x9b */    SDL_SCANCODE_UNKNOWN,
   2.189 +    /*  156, 0x9c */    SDL_SCANCODE_UNKNOWN,
   2.190 +    /*  157, 0x9d */    SDL_SCANCODE_UNKNOWN,
   2.191 +    /*  158, 0x9e */    SDL_SCANCODE_UNKNOWN,
   2.192 +    /*  159, 0x9f */    SDL_SCANCODE_UNKNOWN,
   2.193 +    /*  160, 0xa0 */    SDL_SCANCODE_LSHIFT,
   2.194 +    /*  161, 0xa1 */    SDL_SCANCODE_RSHIFT,
   2.195 +    /*  162, 0xa2 */    SDL_SCANCODE_LCTRL,
   2.196 +    /*  163, 0xa3 */    SDL_SCANCODE_RCTRL,
   2.197 +    /*  164, 0xa4 */    SDL_SCANCODE_LALT,
   2.198 +    /*  165, 0xa5 */    SDL_SCANCODE_RALT,
   2.199 +    /*  166, 0xa6 */    SDL_SCANCODE_AC_BACK,
   2.200 +    /*  167, 0xa7 */    SDL_SCANCODE_AC_FORWARD,
   2.201 +    /*  168, 0xa8 */    SDL_SCANCODE_AC_REFRESH,
   2.202 +    /*  169, 0xa9 */    SDL_SCANCODE_AC_STOP,
   2.203 +    /*  170, 0xaa */    SDL_SCANCODE_AC_SEARCH,
   2.204 +    /*  171, 0xab */    SDL_SCANCODE_AC_BOOKMARKS,
   2.205 +    /*  172, 0xac */    SDL_SCANCODE_AC_HOME,
   2.206 +    /*  173, 0xad */    SDL_SCANCODE_AUDIOMUTE,
   2.207 +    /*  174, 0xae */    SDL_SCANCODE_VOLUMEDOWN,
   2.208 +    /*  175, 0xaf */    SDL_SCANCODE_VOLUMEUP,
   2.209 +    /*  176, 0xb0 */    SDL_SCANCODE_UNKNOWN,
   2.210 +    /*  177, 0xb1 */    SDL_SCANCODE_KP_000,
   2.211 +    /*  178, 0xb2 */    SDL_SCANCODE_KP_EQUALS,
   2.212 +    /*  179, 0xb3 */    SDL_SCANCODE_KP_00,
   2.213 +    /*  180, 0xb4 */    SDL_SCANCODE_UNKNOWN,
   2.214 +    /*  181, 0xb5 */    SDL_SCANCODE_UNKNOWN,
   2.215 +    /*  182, 0xb6 */    SDL_SCANCODE_UNKNOWN,
   2.216 +    /*  183, 0xb7 */    SDL_SCANCODE_UNKNOWN,
   2.217 +    /*  184, 0xb8 */    SDL_SCANCODE_UNKNOWN,
   2.218 +    /*  185, 0xb9 */    SDL_SCANCODE_UNKNOWN,
   2.219 +    /*  186, 0xba */    SDL_SCANCODE_SEMICOLON,
   2.220 +    /*  187, 0xbb */    SDL_SCANCODE_EQUALS,
   2.221 +    /*  188, 0xbc */    SDL_SCANCODE_COMMA,
   2.222 +    /*  189, 0xbd */    SDL_SCANCODE_MINUS,
   2.223 +    /*  190, 0xbe */    SDL_SCANCODE_PERIOD,
   2.224 +    /*  191, 0xbf */    SDL_SCANCODE_SLASH,
   2.225 +    /*  192, 0xc0 */    SDL_SCANCODE_GRAVE,
   2.226 +    /*  193, 0xc1 */    SDL_SCANCODE_UNKNOWN,
   2.227 +    /*  194, 0xc2 */    SDL_SCANCODE_UNKNOWN,
   2.228 +    /*  195, 0xc3 */    SDL_SCANCODE_UNKNOWN,
   2.229 +    /*  196, 0xc4 */    SDL_SCANCODE_UNKNOWN,
   2.230 +    /*  197, 0xc5 */    SDL_SCANCODE_UNKNOWN,
   2.231 +    /*  198, 0xc6 */    SDL_SCANCODE_UNKNOWN,
   2.232 +    /*  199, 0xc7 */    SDL_SCANCODE_UNKNOWN,
   2.233 +    /*  200, 0xc8 */    SDL_SCANCODE_UNKNOWN,
   2.234 +    /*  201, 0xc9 */    SDL_SCANCODE_UNKNOWN,
   2.235 +    /*  202, 0xca */    SDL_SCANCODE_UNKNOWN,
   2.236 +    /*  203, 0xcb */    SDL_SCANCODE_UNKNOWN,
   2.237 +    /*  204, 0xcc */    SDL_SCANCODE_UNKNOWN,
   2.238 +    /*  205, 0xcd */    SDL_SCANCODE_UNKNOWN,
   2.239 +    /*  206, 0xce */    SDL_SCANCODE_UNKNOWN,
   2.240 +    /*  207, 0xcf */    SDL_SCANCODE_UNKNOWN,
   2.241 +    /*  208, 0xd0 */    SDL_SCANCODE_UNKNOWN,
   2.242 +    /*  209, 0xd1 */    SDL_SCANCODE_UNKNOWN,
   2.243 +    /*  210, 0xd2 */    SDL_SCANCODE_UNKNOWN,
   2.244 +    /*  211, 0xd3 */    SDL_SCANCODE_UNKNOWN,
   2.245 +    /*  212, 0xd4 */    SDL_SCANCODE_UNKNOWN,
   2.246 +    /*  213, 0xd5 */    SDL_SCANCODE_UNKNOWN,
   2.247 +    /*  214, 0xd6 */    SDL_SCANCODE_UNKNOWN,
   2.248 +    /*  215, 0xd7 */    SDL_SCANCODE_UNKNOWN,
   2.249 +    /*  216, 0xd8 */    SDL_SCANCODE_UNKNOWN,
   2.250 +    /*  217, 0xd9 */    SDL_SCANCODE_UNKNOWN,
   2.251 +    /*  218, 0xda */    SDL_SCANCODE_UNKNOWN,
   2.252 +    /*  219, 0xdb */    SDL_SCANCODE_LEFTBRACKET,
   2.253 +    /*  220, 0xdc */    SDL_SCANCODE_BACKSLASH,
   2.254 +    /*  221, 0xdd */    SDL_SCANCODE_RIGHTBRACKET,
   2.255 +    /*  222, 0xde */    SDL_SCANCODE_APOSTROPHE,
   2.256 +    /*  223, 0xdf */    SDL_SCANCODE_UNKNOWN,
   2.257 +    /*  224, 0xe0 */    SDL_SCANCODE_UNKNOWN,
   2.258 +    /*  225, 0xe1 */    SDL_SCANCODE_UNKNOWN,
   2.259 +    /*  226, 0xe2 */    SDL_SCANCODE_NONUSBACKSLASH,
   2.260 +    /*  227, 0xe3 */    SDL_SCANCODE_UNKNOWN,
   2.261 +    /*  228, 0xe4 */    SDL_SCANCODE_UNKNOWN,
   2.262 +    /*  229, 0xe5 */    SDL_SCANCODE_UNKNOWN,
   2.263 +    /*  230, 0xe6 */    SDL_SCANCODE_UNKNOWN,
   2.264 +    /*  231, 0xe7 */    SDL_SCANCODE_UNKNOWN,
   2.265 +    /*  232, 0xe8 */    SDL_SCANCODE_UNKNOWN,
   2.266 +    /*  233, 0xe9 */    SDL_SCANCODE_UNKNOWN,
   2.267 +    /*  234, 0xea */    SDL_SCANCODE_UNKNOWN,
   2.268 +    /*  235, 0xeb */    SDL_SCANCODE_UNKNOWN,
   2.269 +    /*  236, 0xec */    SDL_SCANCODE_UNKNOWN,
   2.270 +    /*  237, 0xed */    SDL_SCANCODE_UNKNOWN,
   2.271 +    /*  238, 0xee */    SDL_SCANCODE_UNKNOWN,
   2.272 +    /*  239, 0xef */    SDL_SCANCODE_UNKNOWN,
   2.273 +    /*  240, 0xf0 */    SDL_SCANCODE_UNKNOWN,
   2.274 +    /*  241, 0xf1 */    SDL_SCANCODE_UNKNOWN,
   2.275 +    /*  242, 0xf2 */    SDL_SCANCODE_UNKNOWN,
   2.276 +    /*  243, 0xf3 */    SDL_SCANCODE_UNKNOWN,
   2.277 +    /*  244, 0xf4 */    SDL_SCANCODE_UNKNOWN,
   2.278 +    /*  245, 0xf5 */    SDL_SCANCODE_UNKNOWN,
   2.279 +    /*  246, 0xf6 */    SDL_SCANCODE_SYSREQ,
   2.280 +    /*  247, 0xf7 */    SDL_SCANCODE_CRSEL,
   2.281 +    /*  248, 0xf8 */    SDL_SCANCODE_EXSEL,
   2.282 +    /*  249, 0xf9 */    SDL_SCANCODE_UNKNOWN, /* VK_EREOF */
   2.283 +    /*  250, 0xfa */    SDL_SCANCODE_UNKNOWN, /* VK_PLAY */
   2.284 +    /*  251, 0xfb */    SDL_SCANCODE_UNKNOWN, /* VK_ZOOM */
   2.285 +    /*  252, 0xfc */    SDL_SCANCODE_UNKNOWN,
   2.286 +    /*  253, 0xfd */    SDL_SCANCODE_UNKNOWN, /* VK_PA1 */
   2.287 +    /*  254, 0xfe */    SDL_SCANCODE_CLEAR,
   2.288 +    /*  255, 0xff */    SDL_SCANCODE_UNKNOWN,
   2.289 +};
   2.290 +/* *INDENT-ON* */
     3.1 --- a/src/video/win32/SDL_win32events.c	Thu Feb 07 16:14:43 2008 +0000
     3.2 +++ b/src/video/win32/SDL_win32events.c	Fri Feb 08 08:35:49 2008 +0000
     3.3 @@ -47,356 +47,6 @@
     3.4  #define GET_XBUTTON_WPARAM(w) (HIWORD(w))
     3.5  #endif
     3.6  
     3.7 -static SDLKey
     3.8 -TranslateKey(WPARAM vkey)
     3.9 -{
    3.10 -    SDLKey key;
    3.11 -
    3.12 -    /* FIXME: Assign vkey directly to key if in ASCII range */
    3.13 -    switch (vkey) {
    3.14 -    case VK_BACK:
    3.15 -        key = SDLK_BACKSPACE;
    3.16 -        break;
    3.17 -    case VK_TAB:
    3.18 -        key = SDLK_TAB;
    3.19 -        break;
    3.20 -    case VK_CLEAR:
    3.21 -        key = SDLK_CLEAR;
    3.22 -        break;
    3.23 -    case VK_RETURN:
    3.24 -        key = SDLK_RETURN;
    3.25 -        break;
    3.26 -    case VK_PAUSE:
    3.27 -        key = SDLK_PAUSE;
    3.28 -        break;
    3.29 -    case VK_ESCAPE:
    3.30 -        key = SDLK_ESCAPE;
    3.31 -        break;
    3.32 -    case VK_SPACE:
    3.33 -        key = SDLK_SPACE;
    3.34 -        break;
    3.35 -    case VK_APOSTROPHE:
    3.36 -        key = SDLK_QUOTE;
    3.37 -        break;
    3.38 -    case VK_COMMA:
    3.39 -        key = SDLK_COMMA;
    3.40 -        break;
    3.41 -    case VK_MINUS:
    3.42 -        key = SDLK_MINUS;
    3.43 -        break;
    3.44 -    case VK_PERIOD:
    3.45 -        key = SDLK_PERIOD;
    3.46 -        break;
    3.47 -    case VK_SLASH:
    3.48 -        key = SDLK_SLASH;
    3.49 -        break;
    3.50 -    case VK_0:
    3.51 -        key = SDLK_0;
    3.52 -        break;
    3.53 -    case VK_1:
    3.54 -        key = SDLK_1;
    3.55 -        break;
    3.56 -    case VK_2:
    3.57 -        key = SDLK_2;
    3.58 -        break;
    3.59 -    case VK_3:
    3.60 -        key = SDLK_3;
    3.61 -        break;
    3.62 -    case VK_4:
    3.63 -        key = SDLK_4;
    3.64 -        break;
    3.65 -    case VK_5:
    3.66 -        key = SDLK_5;
    3.67 -        break;
    3.68 -    case VK_6:
    3.69 -        key = SDLK_6;
    3.70 -        break;
    3.71 -    case VK_7:
    3.72 -        key = SDLK_7;
    3.73 -        break;
    3.74 -    case VK_8:
    3.75 -        key = SDLK_8;
    3.76 -        break;
    3.77 -    case VK_9:
    3.78 -        key = SDLK_9;
    3.79 -        break;
    3.80 -    case VK_SEMICOLON:
    3.81 -        key = SDLK_SEMICOLON;
    3.82 -        break;
    3.83 -    case VK_EQUALS:
    3.84 -        key = SDLK_EQUALS;
    3.85 -        break;
    3.86 -    case VK_LBRACKET:
    3.87 -        key = SDLK_LEFTBRACKET;
    3.88 -        break;
    3.89 -    case VK_BACKSLASH:
    3.90 -        key = SDLK_BACKSLASH;
    3.91 -        break;
    3.92 -    case VK_OEM_102:
    3.93 -        key = SDLK_LESS;
    3.94 -        break;
    3.95 -    case VK_RBRACKET:
    3.96 -        key = SDLK_RIGHTBRACKET;
    3.97 -        break;
    3.98 -    case VK_GRAVE:
    3.99 -        key = SDLK_BACKQUOTE;
   3.100 -        break;
   3.101 -    case VK_BACKTICK:
   3.102 -        key = SDLK_BACKQUOTE;
   3.103 -        break;
   3.104 -    case VK_A:
   3.105 -        key = SDLK_a;
   3.106 -        break;
   3.107 -    case VK_B:
   3.108 -        key = SDLK_b;
   3.109 -        break;
   3.110 -    case VK_C:
   3.111 -        key = SDLK_c;
   3.112 -        break;
   3.113 -    case VK_D:
   3.114 -        key = SDLK_d;
   3.115 -        break;
   3.116 -    case VK_E:
   3.117 -        key = SDLK_e;
   3.118 -        break;
   3.119 -    case VK_F:
   3.120 -        key = SDLK_f;
   3.121 -        break;
   3.122 -    case VK_G:
   3.123 -        key = SDLK_g;
   3.124 -        break;
   3.125 -    case VK_H:
   3.126 -        key = SDLK_h;
   3.127 -        break;
   3.128 -    case VK_I:
   3.129 -        key = SDLK_i;
   3.130 -        break;
   3.131 -    case VK_J:
   3.132 -        key = SDLK_j;
   3.133 -        break;
   3.134 -    case VK_K:
   3.135 -        key = SDLK_k;
   3.136 -        break;
   3.137 -    case VK_L:
   3.138 -        key = SDLK_l;
   3.139 -        break;
   3.140 -    case VK_M:
   3.141 -        key = SDLK_m;
   3.142 -        break;
   3.143 -    case VK_N:
   3.144 -        key = SDLK_n;
   3.145 -        break;
   3.146 -    case VK_O:
   3.147 -        key = SDLK_o;
   3.148 -        break;
   3.149 -    case VK_P:
   3.150 -        key = SDLK_p;
   3.151 -        break;
   3.152 -    case VK_Q:
   3.153 -        key = SDLK_q;
   3.154 -        break;
   3.155 -    case VK_R:
   3.156 -        key = SDLK_r;
   3.157 -        break;
   3.158 -    case VK_S:
   3.159 -        key = SDLK_s;
   3.160 -        break;
   3.161 -    case VK_T:
   3.162 -        key = SDLK_t;
   3.163 -        break;
   3.164 -    case VK_U:
   3.165 -        key = SDLK_u;
   3.166 -        break;
   3.167 -    case VK_V:
   3.168 -        key = SDLK_v;
   3.169 -        break;
   3.170 -    case VK_W:
   3.171 -        key = SDLK_w;
   3.172 -        break;
   3.173 -    case VK_X:
   3.174 -        key = SDLK_x;
   3.175 -        break;
   3.176 -    case VK_Y:
   3.177 -        key = SDLK_y;
   3.178 -        break;
   3.179 -    case VK_Z:
   3.180 -        key = SDLK_z;
   3.181 -        break;
   3.182 -    case VK_DELETE:
   3.183 -        key = SDLK_DELETE;
   3.184 -        break;
   3.185 -    case VK_NUMPAD0:
   3.186 -        key = SDLK_KP0;
   3.187 -        break;
   3.188 -    case VK_NUMPAD1:
   3.189 -        key = SDLK_KP1;
   3.190 -        break;
   3.191 -    case VK_NUMPAD2:
   3.192 -        key = SDLK_KP2;
   3.193 -        break;
   3.194 -    case VK_NUMPAD3:
   3.195 -        key = SDLK_KP3;
   3.196 -        break;
   3.197 -    case VK_NUMPAD4:
   3.198 -        key = SDLK_KP4;
   3.199 -        break;
   3.200 -    case VK_NUMPAD5:
   3.201 -        key = SDLK_KP5;
   3.202 -        break;
   3.203 -    case VK_NUMPAD6:
   3.204 -        key = SDLK_KP6;
   3.205 -        break;
   3.206 -    case VK_NUMPAD7:
   3.207 -        key = SDLK_KP7;
   3.208 -        break;
   3.209 -    case VK_NUMPAD8:
   3.210 -        key = SDLK_KP8;
   3.211 -        break;
   3.212 -    case VK_NUMPAD9:
   3.213 -        key = SDLK_KP9;
   3.214 -        break;
   3.215 -    case VK_DECIMAL:
   3.216 -        key = SDLK_KP_PERIOD;
   3.217 -        break;
   3.218 -    case VK_DIVIDE:
   3.219 -        key = SDLK_KP_DIVIDE;
   3.220 -        break;
   3.221 -    case VK_MULTIPLY:
   3.222 -        key = SDLK_KP_MULTIPLY;
   3.223 -        break;
   3.224 -    case VK_SUBTRACT:
   3.225 -        key = SDLK_KP_MINUS;
   3.226 -        break;
   3.227 -    case VK_ADD:
   3.228 -        key = SDLK_KP_PLUS;
   3.229 -        break;
   3.230 -    case VK_UP:
   3.231 -        key = SDLK_UP;
   3.232 -        break;
   3.233 -    case VK_DOWN:
   3.234 -        key = SDLK_DOWN;
   3.235 -        break;
   3.236 -    case VK_RIGHT:
   3.237 -        key = SDLK_RIGHT;
   3.238 -        break;
   3.239 -    case VK_LEFT:
   3.240 -        key = SDLK_LEFT;
   3.241 -        break;
   3.242 -    case VK_INSERT:
   3.243 -        key = SDLK_INSERT;
   3.244 -        break;
   3.245 -    case VK_HOME:
   3.246 -        key = SDLK_HOME;
   3.247 -        break;
   3.248 -    case VK_END:
   3.249 -        key = SDLK_END;
   3.250 -        break;
   3.251 -    case VK_PRIOR:
   3.252 -        key = SDLK_PAGEUP;
   3.253 -        break;
   3.254 -    case VK_NEXT:
   3.255 -        key = SDLK_PAGEDOWN;
   3.256 -        break;
   3.257 -    case VK_F1:
   3.258 -        key = SDLK_F1;
   3.259 -        break;
   3.260 -    case VK_F2:
   3.261 -        key = SDLK_F2;
   3.262 -        break;
   3.263 -    case VK_F3:
   3.264 -        key = SDLK_F3;
   3.265 -        break;
   3.266 -    case VK_F4:
   3.267 -        key = SDLK_F4;
   3.268 -        break;
   3.269 -    case VK_F5:
   3.270 -        key = SDLK_F5;
   3.271 -        break;
   3.272 -    case VK_F6:
   3.273 -        key = SDLK_F6;
   3.274 -        break;
   3.275 -    case VK_F7:
   3.276 -        key = SDLK_F7;
   3.277 -        break;
   3.278 -    case VK_F8:
   3.279 -        key = SDLK_F8;
   3.280 -        break;
   3.281 -    case VK_F9:
   3.282 -        key = SDLK_F9;
   3.283 -        break;
   3.284 -    case VK_F10:
   3.285 -        key = SDLK_F10;
   3.286 -        break;
   3.287 -    case VK_F11:
   3.288 -        key = SDLK_F11;
   3.289 -        break;
   3.290 -    case VK_F12:
   3.291 -        key = SDLK_F12;
   3.292 -        break;
   3.293 -    case VK_F13:
   3.294 -        key = SDLK_F13;
   3.295 -        break;
   3.296 -    case VK_F14:
   3.297 -        key = SDLK_F14;
   3.298 -        break;
   3.299 -    case VK_F15:
   3.300 -        key = SDLK_F15;
   3.301 -        break;
   3.302 -    case VK_NUMLOCK:
   3.303 -        key = SDLK_NUMLOCK;
   3.304 -        break;
   3.305 -    case VK_CAPITAL:
   3.306 -        key = SDLK_CAPSLOCK;
   3.307 -        break;
   3.308 -    case VK_SCROLL:
   3.309 -        key = SDLK_SCROLLOCK;
   3.310 -        break;
   3.311 -    case VK_RSHIFT:
   3.312 -        key = SDLK_RSHIFT;
   3.313 -        break;
   3.314 -    case VK_LSHIFT:
   3.315 -        key = SDLK_LSHIFT;
   3.316 -        break;
   3.317 -    case VK_RCONTROL:
   3.318 -        key = SDLK_RCTRL;
   3.319 -        break;
   3.320 -    case VK_LCONTROL:
   3.321 -        key = SDLK_LCTRL;
   3.322 -        break;
   3.323 -    case VK_RMENU:
   3.324 -        key = SDLK_RALT;
   3.325 -        break;
   3.326 -    case VK_LMENU:
   3.327 -        key = SDLK_LALT;
   3.328 -        break;
   3.329 -    case VK_RWIN:
   3.330 -        key = SDLK_RSUPER;
   3.331 -        break;
   3.332 -    case VK_LWIN:
   3.333 -        key = SDLK_LSUPER;
   3.334 -        break;
   3.335 -    case VK_HELP:
   3.336 -        key = SDLK_HELP;
   3.337 -        break;
   3.338 -    case VK_PRINT:
   3.339 -        key = SDLK_PRINT;
   3.340 -        break;
   3.341 -    case VK_SNAPSHOT:
   3.342 -        key = SDLK_PRINT;
   3.343 -        break;
   3.344 -    case VK_CANCEL:
   3.345 -        key = SDLK_BREAK;
   3.346 -        break;
   3.347 -    case VK_APPS:
   3.348 -        key = SDLK_MENU;
   3.349 -        break;
   3.350 -    default:
   3.351 -        key = SDLK_UNKNOWN;
   3.352 -        break;
   3.353 -    }
   3.354 -    return key;
   3.355 -}
   3.356 -
   3.357  LRESULT CALLBACK
   3.358  WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   3.359  {
   3.360 @@ -670,11 +320,11 @@
   3.361              case VK_SHIFT:
   3.362                  /* EXTENDED trick doesn't work here */
   3.363                  {
   3.364 -                    Uint8 *state = SDL_GetKeyState(NULL);
   3.365 -                    if (state[SDLK_LSHIFT] == SDL_RELEASED
   3.366 +                    Uint8 *state = SDL_GetKeyboardState(NULL);
   3.367 +                    if (state[SDL_SCANCODE_LSHIFT] == SDL_RELEASED
   3.368                          && (GetKeyState(VK_LSHIFT) & 0x8000)) {
   3.369                          wParam = VK_LSHIFT;
   3.370 -                    } else if (state[SDLK_RSHIFT] == SDL_RELEASED
   3.371 +                    } else if (state[SDL_SCANCODE_RSHIFT] == SDL_RELEASED
   3.372                                 && (GetKeyState(VK_RSHIFT) & 0x8000)) {
   3.373                          wParam = VK_RSHIFT;
   3.374                      } else {
   3.375 @@ -690,8 +340,10 @@
   3.376                      wParam = VK_LMENU;
   3.377                  break;
   3.378              }
   3.379 -            SDL_SendKeyboardKey(index, SDL_PRESSED, (Uint8) HIWORD(lParam),
   3.380 -                                TranslateKey(wParam));
   3.381 +            if (wParam < 256) {
   3.382 +                SDL_SendKeyboardKey(index, SDL_PRESSED,
   3.383 +                                    data->videodata->key_layout[wParam]);
   3.384 +            }
   3.385          }
   3.386          return (0);
   3.387  
   3.388 @@ -711,11 +363,11 @@
   3.389              case VK_SHIFT:
   3.390                  /* EXTENDED trick doesn't work here */
   3.391                  {
   3.392 -                    Uint8 *state = SDL_GetKeyState(NULL);
   3.393 -                    if (state[SDLK_LSHIFT] == SDL_PRESSED
   3.394 +                    Uint8 *state = SDL_GetKeyboardState(NULL);
   3.395 +                    if (state[SDL_SCANCODE_LSHIFT] == SDL_PRESSED
   3.396                          && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
   3.397                          wParam = VK_LSHIFT;
   3.398 -                    } else if (state[SDLK_RSHIFT] == SDL_PRESSED
   3.399 +                    } else if (state[SDL_SCANCODE_RSHIFT] == SDL_PRESSED
   3.400                                 && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
   3.401                          wParam = VK_RSHIFT;
   3.402                      } else {
   3.403 @@ -733,13 +385,15 @@
   3.404              }
   3.405              /* Windows only reports keyup for print screen */
   3.406              if (wParam == VK_SNAPSHOT
   3.407 -                && SDL_GetKeyState(NULL)[SDLK_PRINT] == SDL_RELEASED) {
   3.408 +                && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
   3.409 +                SDL_RELEASED) {
   3.410                  SDL_SendKeyboardKey(index, SDL_PRESSED,
   3.411 -                                    (Uint8) HIWORD(lParam),
   3.412 -                                    TranslateKey(wParam));
   3.413 +                                    data->videodata->key_layout[wParam]);
   3.414              }
   3.415 -            SDL_SendKeyboardKey(index, SDL_RELEASED, (Uint8) HIWORD(lParam),
   3.416 -                                TranslateKey(wParam));
   3.417 +            if (wParam < 256) {
   3.418 +                SDL_SendKeyboardKey(index, SDL_RELEASED,
   3.419 +                                    data->videodata->key_layout[wParam]);
   3.420 +            }
   3.421          }
   3.422          return (0);
   3.423  
     4.1 --- a/src/video/win32/SDL_win32keyboard.c	Thu Feb 07 16:14:43 2008 +0000
     4.2 +++ b/src/video/win32/SDL_win32keyboard.c	Fri Feb 08 08:35:49 2008 +0000
     4.3 @@ -24,6 +24,7 @@
     4.4  #include "SDL_win32video.h"
     4.5  
     4.6  #include "../../events/SDL_keyboard_c.h"
     4.7 +#include "../../events/scancodes_win32.h"
     4.8  
     4.9  void
    4.10  WIN_InitKeyboard(_THIS)
    4.11 @@ -31,8 +32,41 @@
    4.12      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    4.13      SDL_Keyboard keyboard;
    4.14  
    4.15 +    data->key_layout = win32_scancode_table;
    4.16 +
    4.17      SDL_zero(keyboard);
    4.18      data->keyboard = SDL_AddKeyboard(&keyboard, -1);
    4.19 +    WIN_UpdateKeymap(_this);
    4.20 +
    4.21 +    SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
    4.22 +    SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows");
    4.23 +    SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");
    4.24 +}
    4.25 +
    4.26 +void
    4.27 +WIN_UpdateKeymap(_THIS)
    4.28 +{
    4.29 +    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    4.30 +    int i;
    4.31 +    SDL_scancode scancode;
    4.32 +    SDLKey keymap[SDL_NUM_SCANCODES];
    4.33 +
    4.34 +    SDL_GetDefaultKeymap(keymap);
    4.35 +
    4.36 +    for (i = 0; i < SDL_arraysize(win32_scancode_table); i++) {
    4.37 +
    4.38 +        /* Make sure this scancode is a valid character scancode */
    4.39 +        scancode = win32_scancode_table[i];
    4.40 +        if (scancode == SDL_SCANCODE_UNKNOWN ||
    4.41 +            (keymap[scancode] & SDLK_SCANCODE_MASK)) {
    4.42 +            continue;
    4.43 +        }
    4.44 +#ifndef MAPVK_VK_TO_CHAR
    4.45 +#define MAPVK_VK_TO_CHAR    2
    4.46 +#endif
    4.47 +        keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF);
    4.48 +    }
    4.49 +    SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
    4.50  }
    4.51  
    4.52  void
     5.1 --- a/src/video/win32/SDL_win32keyboard.h	Thu Feb 07 16:14:43 2008 +0000
     5.2 +++ b/src/video/win32/SDL_win32keyboard.h	Fri Feb 08 08:35:49 2008 +0000
     5.3 @@ -25,6 +25,7 @@
     5.4  #define _SDL_win32keyboard_h
     5.5  
     5.6  extern void WIN_InitKeyboard(_THIS);
     5.7 +extern void WIN_UpdateKeymap(_THIS);
     5.8  extern void WIN_QuitKeyboard(_THIS);
     5.9  
    5.10  #endif /* _SDL_win32keyboard_h */
     6.1 --- a/src/video/win32/SDL_win32video.h	Thu Feb 07 16:14:43 2008 +0000
     6.2 +++ b/src/video/win32/SDL_win32video.h	Fri Feb 08 08:35:49 2008 +0000
     6.3 @@ -63,6 +63,7 @@
     6.4  #endif
     6.5      int mouse;
     6.6      int keyboard;
     6.7 +    SDL_scancode *key_layout;
     6.8  } SDL_VideoData;
     6.9  
    6.10  #endif /* _SDL_win32video_h */
     7.1 --- a/src/video/x11/SDL_x11keyboard.c	Thu Feb 07 16:14:43 2008 +0000
     7.2 +++ b/src/video/x11/SDL_x11keyboard.c	Fri Feb 08 08:35:49 2008 +0000
     7.3 @@ -277,14 +277,16 @@
     7.4      0,                          /* SDL_SCANCODE_SLEEP ? */
     7.5  };
     7.6  
     7.7 +/* *INDENT-OFF* */
     7.8  static struct
     7.9  {
    7.10      SDL_scancode *table;
    7.11      int table_size;
    7.12  } scancode_set[] = {
    7.13 -    {
    7.14 -    darwin_scancode_table, SDL_arraysize(darwin_scancode_table)}, {
    7.15 -xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table)},};
    7.16 +    { darwin_scancode_table, SDL_arraysize(darwin_scancode_table) },
    7.17 +    { xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) },
    7.18 +};
    7.19 +/* *INDENT-OFF* */
    7.20  
    7.21  int
    7.22  X11_InitKeyboard(_THIS)