1 /* 2 * ReactOS Italian Keyboard layout 3 * Copyright (C) 2007 ReactOS 4 * License: LGPL, see: LGPL.txt 5 * 6 */ 7 8 #define WIN32_NO_STATUS 9 #include <stdarg.h> 10 #include <windef.h> 11 #include <winuser.h> 12 #include <ndk/kbd.h> 13 14 #ifdef _M_IA64 15 #define ROSDATA static __declspec(allocate(".data")) 16 #else 17 #ifdef _MSC_VER 18 #pragma data_seg(".data") 19 #define ROSDATA static 20 #else 21 #define ROSDATA static __attribute__((section(".data"))) 22 #endif 23 #endif 24 25 #define VK_EMPTY 0xff /* The non-existent VK */ 26 27 #define KNUMS KBDNUMPAD|KBDSPECIAL /* Special + number pad */ 28 #define KMEXT KBDEXT|KBDMULTIVK /* Multi + ext */ 29 30 ROSDATA USHORT scancode_to_vk[] = { 31 /* 00 */ VK_EMPTY, 32 /* 01 */ VK_ESCAPE, 33 /* 02 */ '1', 34 /* 03 */ '2', 35 /* 04 */ '3', 36 /* 05 */ '4', 37 /* 06 */ '5', 38 /* 07 */ '6', 39 /* 08 */ '7', 40 /* 09 */ '8', 41 /* 0a */ '9', 42 /* 0b */ '0', 43 /* 0c */ VK_OEM_4, 44 /* 0d */ VK_OEM_6, 45 /* 0e */ VK_BACK, 46 /* 0f */ VK_TAB, 47 /* 10 */ 'Q', 48 /* 11 */ 'W', 49 /* 12 */ 'E', 50 /* 13 */ 'R', 51 /* 14 */ 'T', 52 /* 15 */ 'Y', 53 /* 16 */ 'U', 54 /* 17 */ 'I', 55 /* 18 */ 'O', 56 /* 19 */ 'P', 57 /* 1a */ VK_OEM_1, 58 /* 1b */ VK_OEM_PLUS, 59 /* 1c */ VK_RETURN, 60 /* 1d */ VK_LCONTROL, 61 /* 1e */ 'A', 62 /* 1f */ 'S', 63 /* 20 */ 'D', 64 /* 21 */ 'F', 65 /* 22 */ 'G', 66 /* 23 */ 'H', 67 /* 24 */ 'J', 68 /* 25 */ 'K', 69 /* 26 */ 'L', 70 /* 27 */ VK_OEM_3, 71 /* 28 */ VK_OEM_7, 72 /* 29 */ VK_OEM_2, 73 /* 2a */ VK_LSHIFT, 74 /* 2b */ VK_OEM_5, 75 /* 2c */ 'Z', 76 /* 2d */ 'X', 77 /* 2e */ 'C', 78 /* 2f */ 'V', 79 /* 30 */ 'B', 80 /* 31 */ 'N', 81 /* 32 */ 'M', 82 /* 33 */ VK_OEM_COMMA, 83 /* 34 */ VK_OEM_PERIOD, 84 /* 35 */ VK_OEM_MINUS, 85 /* 36 */ VK_RSHIFT, 86 /* 37 */ VK_MULTIPLY, 87 /* 38 */ VK_LMENU, 88 /* 39 */ VK_SPACE, 89 /* 3a */ VK_CAPITAL, 90 /* 3b */ VK_F1, 91 /* 3c */ VK_F2, 92 /* 3d */ VK_F3, 93 /* 3e */ VK_F4, 94 /* 3f */ VK_F5, 95 /* 40 */ VK_F6, 96 /* 41 */ VK_F7, 97 /* 42 */ VK_F8, 98 /* 43 */ VK_F9, 99 /* 44 */ VK_F10, 100 /* 45 */ VK_NUMLOCK | KMEXT, 101 /* 46 */ VK_SCROLL | KBDMULTIVK, 102 /* 47 */ VK_HOME | KNUMS, 103 /* 48 */ VK_UP | KNUMS, 104 /* 49 */ VK_PRIOR | KNUMS, 105 /* 4a */ VK_SUBTRACT, 106 /* 4b */ VK_LEFT | KNUMS, 107 /* 4c */ VK_CLEAR | KNUMS, 108 /* 4d */ VK_RIGHT | KNUMS, 109 /* 4e */ VK_ADD, 110 /* 4f */ VK_END | KNUMS, 111 /* 50 */ VK_DOWN | KNUMS, 112 /* 51 */ VK_NEXT | KNUMS, 113 /* 52 */ VK_INSERT | KNUMS, 114 /* 53 */ VK_DELETE | KNUMS, 115 /* 54 */ VK_SNAPSHOT, 116 /* 55 */ VK_EMPTY, 117 /* 56 */ VK_OEM_102, 118 /* 57 */ VK_F11, 119 /* 58 */ VK_F12, 120 /* 59 */ VK_EMPTY, 121 /* 5a */ VK_CLEAR, 122 /* 5b */ VK_EMPTY, 123 /* 5c */ VK_EMPTY, 124 /* 5d */ VK_EMPTY, 125 /* 5e */ VK_EMPTY, /* EREOF */ 126 /* 5f */ VK_EMPTY, 127 /* 60 */ VK_EMPTY, 128 /* 61 */ VK_EMPTY, 129 /* 62 */ VK_EMPTY, 130 /* 63 */ VK_EMPTY, /* ZOOM */ 131 /* 64 */ VK_HELP, 132 /* 65 */ VK_F13, 133 /* 66 */ VK_F14, 134 /* 67 */ VK_F15, 135 /* 68 */ VK_F16, 136 /* 69 */ VK_F17, 137 /* 6a */ VK_F18, 138 /* 6b */ VK_F19, 139 /* 6c */ VK_F20, 140 /* 6d */ VK_F21, 141 /* 6e */ VK_F22, 142 /* 6f */ VK_F23, 143 /* 70 */ VK_EMPTY, 144 /* 71 */ VK_EMPTY, 145 /* 72 */ VK_EMPTY, 146 /* 73 */ VK_EMPTY, 147 /* 74 */ VK_EMPTY, 148 /* 75 */ VK_EMPTY, 149 /* 76 */ VK_EMPTY, 150 /* 77 */ VK_F24, 151 /* 78 */ VK_EMPTY, 152 /* 79 */ VK_EMPTY, 153 /* 7a */ VK_EMPTY, 154 /* 7b */ VK_EMPTY, 155 /* 7c */ VK_EMPTY, 156 /* 7d */ VK_EMPTY, 157 /* 7e */ VK_EMPTY, 158 }; 159 160 ROSDATA VSC_VK extcode0_to_vk[] = { 161 { 0x10, VK_MEDIA_PREV_TRACK | KBDEXT }, 162 { 0x19, VK_MEDIA_NEXT_TRACK | KBDEXT }, 163 { 0x1D, VK_RCONTROL | KBDEXT }, 164 { 0x20, VK_VOLUME_MUTE | KBDEXT }, 165 { 0x21, VK_LAUNCH_APP2 | KBDEXT }, 166 { 0x22, VK_MEDIA_PLAY_PAUSE | KBDEXT }, 167 { 0x24, VK_MEDIA_STOP | KBDEXT }, 168 { 0x2E, VK_VOLUME_DOWN | KBDEXT }, 169 { 0x30, VK_VOLUME_UP | KBDEXT }, 170 { 0x32, VK_BROWSER_HOME | KBDEXT }, 171 { 0x35, VK_DIVIDE | KBDEXT }, 172 { 0x37, VK_SNAPSHOT | KBDEXT }, 173 { 0x38, VK_RMENU | KBDEXT }, 174 { 0x47, VK_HOME | KBDEXT }, 175 { 0x48, VK_UP | KBDEXT }, 176 { 0x49, VK_PRIOR | KBDEXT }, 177 { 0x4B, VK_LEFT | KBDEXT }, 178 { 0x4D, VK_RIGHT | KBDEXT }, 179 { 0x4F, VK_END | KBDEXT }, 180 { 0x50, VK_DOWN | KBDEXT }, 181 { 0x51, VK_NEXT | KBDEXT }, 182 { 0x52, VK_INSERT | KBDEXT }, 183 { 0x53, VK_DELETE | KBDEXT }, 184 { 0x5B, VK_LWIN | KBDEXT }, 185 { 0x5C, VK_RWIN | KBDEXT }, 186 { 0x5D, VK_APPS | KBDEXT }, 187 { 0x5F, VK_SLEEP | KBDEXT }, 188 { 0x65, VK_BROWSER_SEARCH | KBDEXT }, 189 { 0x66, VK_BROWSER_FAVORITES | KBDEXT }, 190 { 0x67, VK_BROWSER_REFRESH | KBDEXT }, 191 { 0x68, VK_BROWSER_STOP | KBDEXT }, 192 { 0x69, VK_BROWSER_FORWARD | KBDEXT }, 193 { 0x6A, VK_BROWSER_BACK | KBDEXT }, 194 { 0x6B, VK_LAUNCH_APP1 | KBDEXT }, 195 { 0x6C, VK_LAUNCH_MAIL | KBDEXT }, 196 { 0x6D, VK_LAUNCH_MEDIA_SELECT | KBDEXT }, 197 { 0x1C, VK_RETURN | KBDEXT }, 198 { 0x46, VK_CANCEL | KBDEXT }, 199 { 0, 0 }, 200 }; 201 202 ROSDATA VSC_VK extcode1_to_vk[] = { 203 { 0x1d, VK_PAUSE }, 204 { 0, 0 }, 205 }; 206 207 ROSDATA VK_TO_BIT modifier_keys[] = { 208 { VK_SHIFT, KBDSHIFT }, 209 { VK_CONTROL, KBDCTRL }, 210 { VK_MENU, KBDALT }, 211 { 0, 0 } 212 }; 213 214 ROSDATA MODIFIERS modifier_bits = { 215 modifier_keys, 216 6, 217 { 0, 1, 2, 4, SHFT_INVALID, SHFT_INVALID, 3 } 218 }; 219 220 ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { 221 /* Normal vs Shifted */ 222 /* The alphabet */ 223 { 'A', CAPLOK, {'a', 'A'} }, 224 { 'B', CAPLOK, {'b', 'B'} }, 225 { 'C', CAPLOK, {'c', 'C'} }, 226 { 'D', CAPLOK, {'d', 'D'} }, 227 { 'F', CAPLOK, {'f', 'F'} }, 228 { 'G', CAPLOK, {'g', 'G'} }, 229 { 'H', CAPLOK, {'h', 'H'} }, 230 { 'I', CAPLOK, {'i', 'I'} }, 231 { 'J', CAPLOK, {'j', 'J'} }, 232 { 'K', CAPLOK, {'k', 'K'} }, 233 { 'L', CAPLOK, {'l', 'L'} }, 234 { 'M', CAPLOK, {'m', 'M'} }, 235 { 'N', CAPLOK, {'n', 'N'} }, 236 { 'O', CAPLOK, {'o', 'O'} }, 237 { 'P', CAPLOK, {'p', 'P'} }, 238 { 'Q', CAPLOK, {'q', 'Q'} }, 239 { 'R', CAPLOK, {'r', 'R'} }, 240 { 'S', CAPLOK, {'s', 'S'} }, 241 { 'T', CAPLOK, {'t', 'T'} }, 242 { 'U', CAPLOK, {'u', 'U'} }, 243 { 'V', CAPLOK, {'v', 'V'} }, 244 { 'W', CAPLOK, {'w', 'W'} }, 245 { 'X', CAPLOK, {'x', 'X'} }, 246 { 'Y', CAPLOK, {'y', 'Y'} }, 247 { 'Z', CAPLOK, {'z', 'Z'} }, 248 249 /* The numbers */ 250 { '1', 0, {'1', '!'} }, 251 { '2', 0, {'2', '"'} }, 252 { '3', 0, {'3', 0x00a3} }, 253 { '4', 0, {'4', '$'} }, 254 { '5', 0, {'5', '%'} }, 255 { '6', 0, {'6', '&'} }, 256 { '7', 0, {'7', '/'} }, 257 { '8', 0, {'8', '('} }, 258 { '9', 0, {'9', ')'} }, 259 { '0', 0, {'0', '='} }, 260 261 /* Specials */ 262 /* Ctrl-_ generates US */ 263 { VK_OEM_2 ,0, {'\\', '|'} }, 264 { VK_OEM_4 ,0, {'\'', '?'} }, 265 { VK_OEM_102 ,0, {'<', '>'} }, 266 { VK_OEM_COMMA ,0, {',', ';'} }, 267 { VK_OEM_PERIOD ,0, {'.', ':'} }, 268 { VK_OEM_MINUS ,0, {'-', '_'} }, 269 /* Keys that do not have shift states */ 270 { VK_TAB ,0, {'\t','\t'} }, 271 { VK_ADD ,0, {'+', '+'} }, 272 { VK_SUBTRACT,0, {'-', '-'} }, 273 { VK_MULTIPLY,0, {'*', '*'} }, 274 { VK_DIVIDE ,0, {'/', '/'} }, 275 { VK_ESCAPE ,0, {0x1b,0x1b} }, 276 { VK_SPACE ,0, {' ', ' '} }, 277 { VK_OEM_5 ,0, {0x00f9, 0x00a7} },//�� 278 { 0, 0 } 279 }; 280 281 ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { 282 /* Normal, Shifted, Ctrl */ 283 /* Legacy (telnet-style) ascii escapes */ 284 { VK_RETURN,0, {'\r', '\r', '\n'} }, 285 { 0,0 } 286 }; 287 288 ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { 289 /* Normal, Shifted, Ctrl, C-S-x */ 290 { VK_OEM_6, 0, {0x00ec, '^', WCH_NONE, '~' } }, 291 { VK_OEM_3, 0, {0x00f2, 0x00e7, WCH_NONE, '@' } },//�� 292 { VK_OEM_7, 0, {0x00e0, 0x00b0, WCH_NONE, '#'} },//� 293 294 { VK_OEM_1, 0, {0x00e8, 0x00e9, '{', '['} },// �� 295 { VK_OEM_PLUS,0, {'+', '*', '}', ']'} }, 296 297 /* The alphabet */ 298 { 'E', CAPLOK, {'e', 'E', 0x05, 0x20AC} }, // eE� 299 300 /* Legacy Ascii generators */ 301 //zz { VK_OEM_MINUS, 0, {'\'', '?', WCH_NONE, 0x1f /* US */} }, 302 { 0, 0 } 303 }; 304 305 ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { 306 { VK_NUMPAD0, 0, {'0'} }, 307 { VK_NUMPAD1, 0, {'1'} }, 308 { VK_NUMPAD2, 0, {'2'} }, 309 { VK_NUMPAD3, 0, {'3'} }, 310 { VK_NUMPAD4, 0, {'4'} }, 311 { VK_NUMPAD5, 0, {'5'} }, 312 { VK_NUMPAD6, 0, {'6'} }, 313 { VK_NUMPAD7, 0, {'7'} }, 314 { VK_NUMPAD8, 0, {'8'} }, 315 { VK_NUMPAD9, 0, {'9'} }, 316 { VK_DECIMAL, 0, {'.'} }, 317 { VK_BACK, 0, {'\010'} }, 318 { 0,0 } 319 }; 320 321 #define vk_master(n,x) { (PVK_TO_WCHARS1)x, n, sizeof(x[0]) } 322 323 ROSDATA VK_TO_WCHAR_TABLE vk_to_wchar_master_table[] = { 324 vk_master(1,keypad_numbers), 325 vk_master(2,key_to_chars_2mod), 326 vk_master(3,key_to_chars_3mod), 327 vk_master(4,key_to_chars_4mod), 328 { 0,0,0 } 329 }; 330 331 ROSDATA VSC_LPWSTR key_names[] = { 332 { 0x00, L"" }, 333 { 0x01, L"Esc" }, 334 { 0x0e, L"Backspace" }, 335 { 0x0f, L"Tab" }, 336 { 0x1c, L"Enter" }, 337 { 0x1d, L"Ctrl" }, 338 { 0x2a, L"Shift" }, 339 { 0x36, L"Right Shift" }, 340 { 0x37, L"Num *" }, 341 { 0x38, L"Alt" }, 342 { 0x39, L"Space" }, 343 { 0x3a, L"CAPLOK Lock" }, 344 { 0x3b, L"F1" }, 345 { 0x3c, L"F2" }, 346 { 0x3d, L"F3" }, 347 { 0x3e, L"F4" }, 348 { 0x3f, L"F5" }, 349 { 0x40, L"F6" }, 350 { 0x41, L"F7" }, 351 { 0x42, L"F8" }, 352 { 0x43, L"F9" }, 353 { 0x44, L"F10" }, 354 { 0x45, L"Pause" }, 355 { 0x46, L"Scroll Lock" }, 356 { 0x47, L"Num 7" }, 357 { 0x48, L"Num 8" }, 358 { 0x49, L"Num 9" }, 359 { 0x4a, L"Num -" }, 360 { 0x4b, L"Num 4" }, 361 { 0x4c, L"Num 5" }, 362 { 0x4d, L"Num 6" }, 363 { 0x4e, L"Num +" }, 364 { 0x4f, L"Num 1" }, 365 { 0x50, L"Num 2" }, 366 { 0x51, L"Num 3" }, 367 { 0x52, L"Num 0" }, 368 { 0x53, L"Num Del" }, 369 { 0x54, L"Sys Req" }, 370 { 0x57, L"F11" }, 371 { 0x58, L"F12" }, 372 { 0x7c, L"F13" }, 373 { 0x7d, L"F14" }, 374 { 0x7e, L"F15" }, 375 { 0x7f, L"F16" }, 376 { 0x80, L"F17" }, 377 { 0x81, L"F18" }, 378 { 0x82, L"F19" }, 379 { 0x83, L"F20" }, 380 { 0x84, L"F21" }, 381 { 0x85, L"F22" }, 382 { 0x86, L"F23" }, 383 { 0x87, L"F24" }, 384 { 0, NULL }, 385 }; 386 387 ROSDATA VSC_LPWSTR extended_key_names[] = { 388 { 0x1c, L"Num Enter" }, 389 { 0x1d, L"Right Ctrl" }, 390 { 0x35, L"Num /" }, 391 { 0x37, L"Prnt Scrn" }, 392 { 0x38, L"Right Alt" }, 393 { 0x45, L"Num Lock" }, 394 { 0x46, L"Break" }, 395 { 0x47, L"Home" }, 396 { 0x48, L"Up" }, 397 { 0x49, L"Page Up" }, 398 { 0x4a, L"Left" }, 399 { 0x4c, L"Center" }, 400 { 0x4d, L"Right" }, 401 { 0x4f, L"End" }, 402 { 0x50, L"Down" }, 403 { 0x51, L"Page Down" }, 404 { 0x52, L"Insert" }, 405 { 0x53, L"Delete" }, 406 { 0x54, L"<ReactOS>" }, 407 { 0x55, L"Help" }, 408 { 0x56, L"Left Windows" }, 409 { 0x5b, L"Right Windows" }, 410 { 0, NULL }, 411 }; 412 413 /* Finally, the master table */ 414 ROSDATA KBDTABLES keyboard_layout_table = { 415 /* modifier assignments */ 416 &modifier_bits, 417 418 /* character from vk tables */ 419 vk_to_wchar_master_table, 420 421 /* diacritical marks -- currently implemented by wine code */ 422 /* doesn't have any, anyway */ 423 NULL, 424 425 /* Key names */ 426 (VSC_LPWSTR *)key_names, 427 (VSC_LPWSTR *)extended_key_names, 428 NULL, /* Dead key names */ 429 430 /* scan code to virtual key maps */ 431 scancode_to_vk, 432 RTL_NUMBER_OF(scancode_to_vk), 433 extcode0_to_vk, 434 extcode1_to_vk, 435 436 MAKELONG(KLLF_ALTGR, 1), /* Version 1.0 */ 437 438 /* Ligatures */ 439 0, 440 0, 441 NULL 442 }; 443 444 PKBDTABLES WINAPI KbdLayerDescriptor(VOID) { 445 return &keyboard_layout_table; 446 } 447 448