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