|
|
1.1 ! root 1: /****************************** Module Header ******************************\ ! 2: * Module Name: kbd.h ! 3: * ! 4: * Copyright (c) 1985-91, Microsoft Corporation ! 5: * ! 6: * Keyboard table values that form the basis for languages and keyboard types. ! 7: * The basis is US, kbd type 4 - all others are a variation on this. ! 8: * This file is included by all kbd**.h files. ! 9: * ! 10: * History: ! 11: * 10-Jan-1991 GregoryW ! 12: * 23-Apr-1991 IanJa VSC_TO_VK _* macros from oemtab.c ! 13: \***************************************************************************/ ! 14: ! 15: #ifndef _KBD_ ! 16: #define _KBD_ ! 17: ! 18: /****************************************************************************\ ! 19: * ! 20: * Keyboard Layers. Used in kdb??.dll and in usersrv.dll ! 21: * ! 22: \****************************************************************************/ ! 23: ! 24: /* ! 25: * Key Event (KE) structure ! 26: * Stores a Virtual Key event ! 27: */ ! 28: typedef struct tagKE { ! 29: BYTE bScanCode; // Virtual Scan Code (Set 1) ! 30: USHORT usFlaggedVk; // Vk | Flags ! 31: } KE, *PKE; ! 32: ! 33: typedef BOOL (* KEPROC)(PKE pKe); ! 34: ! 35: /* ! 36: * KE.usFlaggedVk values, also used in the keyboard layer tables. ! 37: */ ! 38: #define KBDEXT (USHORT)0x0100 ! 39: #define KBDMULTIVK (USHORT)0x0200 ! 40: #define KBDSPECIAL (USHORT)0x0400 ! 41: #define KBDNUMPAD (USHORT)0x0800 ! 42: #define KBDBREAK (USHORT)0x8000 ! 43: ! 44: /* ! 45: * Key message lParam bits ! 46: */ ! 47: #define EXTENDED_BIT 0x01000000 ! 48: #define DONTCARE_BIT 0x02000000 ! 49: #define FAKE_KEYSTROKE 0x02000000 ! 50: ! 51: /* ! 52: * Keyboard Shift State defines. These correspond to the bit mask defined ! 53: * by the VkKeyScan() API. ! 54: */ ! 55: #define KBDBASE 0 ! 56: #define KBDSHIFT 1 ! 57: #define KBDCTRL 2 ! 58: #define KBDALT 4 ! 59: ! 60: /* ! 61: * Handy diacritics ! 62: */ ! 63: #define GRAVE 0x0300 ! 64: #define ACUTE 0x0301 ! 65: #define CIRCUMFLEX 0x0302 ! 66: #define TILDE 0x0303 ! 67: #define MACRON 0x0304 ! 68: #define OVERSCORE 0x0305 ! 69: #define BREVE 0x0306 ! 70: #define DOT_ABOVE 0x0307 ! 71: #define UMLAUT 0x0308 ! 72: #define DIARESIS UMLAUT ! 73: #define HOOK_ABOVE 0x0309 ! 74: #define RING 0x030A ! 75: #define DOUBLE_ACUTE 0x030B ! 76: #define HACEK 0x030C ! 77: ! 78: #define CEDILLA 0x0327 ! 79: #define OGONEK 0x0328 ! 80: #define TONOS 0x0384 ! 81: #define DIARESIS_TONOS 0x0385 ! 82: ! 83: ! 84: #define wszGRAVE L"\x0300" ! 85: #define wszACUTE L"\x0301" ! 86: #define wszCIRCUMFLEX L"\x0302" ! 87: #define wszTILDE L"\x0303" ! 88: #define wszMACRON L"\x0304" ! 89: #define wszOVERSCORE L"\x0305" ! 90: #define wszBREVE L"\x0306" ! 91: #define wszDOT_ABOVE L"\x0307" ! 92: #define wszUMLAUT L"\x0308" ! 93: #define wszHOOK_ABOVE L"\x0309" ! 94: #define wszRING L"\x030A" ! 95: #define wszDOUBLE_ACUTE L"\x030B" ! 96: #define wszHACEK L"\x030C" ! 97: ! 98: #define wszCEDILLA L"\x0327" ! 99: #define wszOGONEK L"\x0328" ! 100: #define wszTONOS L"\x0384" ! 101: #define wszDIARESIS_TONOS L"\x0385" ! 102: ! 103: /* ! 104: * function prototypes ! 105: */ ! 106: VOID VSCFromSC(PKE pke); ! 107: BYTE VKFromVSC(PKE pke, BYTE bPrefix, LPBYTE afKeyState); ! 108: BOOL KEOEMProcs(PKE pke); ! 109: BOOL KELocaleProcs(PKE pke); ! 110: VOID _KeyEvent(USHORT usVk, WORD wScanCode, DWORD ExtraInfo); ! 111: ! 112: /***************************************************************************\ ! 113: * MODIFIER KEYS ! 114: * ! 115: * All keyboards have "Modifier" keys which are used to alter the behaviour of ! 116: * some of the other keys. These shifter keys are usually: ! 117: * Shift (left and/or right Shift key) ! 118: * Ctrl (left and/or right Ctrl key) ! 119: * Alt (left and/or right Alt key) ! 120: * AltGr (right Alt key only) ! 121: * ! 122: * NOTE: ! 123: * All keyboards use the Shift key. ! 124: * All keyboards use a Ctrl key to generate ASCII control characters. ! 125: * All keyboards with a number pad use the Alt key and the NumPad to ! 126: * generate characters by number. ! 127: * Keyboards using AltGr as a Modifier Key usually translate the Virtual ! 128: * ScanCode to Virtual Keys VK_CTRL + VK_ALT at input time: the Modifier ! 129: * tables should be written to treat Ctrl + Alt as a valid shifter ! 130: * key combination in these cases. ! 131: * ! 132: * By holding down 0 or more of these Modifier keys, a "shift state" is ! 133: * obtained : the shift state may affect the translation of Virtual Scancodes ! 134: * to Virtual Keys and/or the translation of Virtuals Key to Characters. ! 135: * ! 136: * EXAMPLES: ! 137: * ! 138: * Each key on a particular keyboard may be marked with up to five different ! 139: * characters in five different positions: ! 140: * ! 141: * .-------. ! 142: * /| |\ ! 143: * : | 2 4 | : ! 144: * | | | | ! 145: * | | | | ! 146: * | | 1 3 | | ! 147: * | |_______| | ! 148: * | / \ | ! 149: * |/ 5 \| ! 150: * `-----------' ! 151: * ! 152: * A key may also be able to generate a character that is not marked on it: ! 153: * these are ASCII Control chars, lower-case letters and/or "invisible keys". ! 154: * .-------. ! 155: * An example of an "Invisible Key": /| |\ ! 156: * : | > | : ! 157: * The German M24 keyboard 2 should produce the | | | | ! 158: * '|' character when ALT SHIFT is is held down | | | | ! 159: * while the '<' key (shown here) is pressed: | | < \ | | ! 160: * This keyboard has four other invisible | |_______| | ! 161: * characters. France, Italy and Spain also | / \ | ! 162: * support invisible characters on the M24 |/ \| ! 163: * Keyboard 2 with ALT SHIFT depressed. `-----------' ! 164: * ! 165: * The keyboard table must list the keys that contribute to it's shift state, ! 166: * and indicate which combinations are valid. This is done with ! 167: * aCharModifiers[] - convert combinations of Modifier Keys to Bitmasks. ! 168: * and ! 169: * aModification[]; - convert Modifier Bitmasks to enumerated Modifications ! 170: * ! 171: * AN EXAMPLE OF VALID AND INVALID MODIFIER KEY COMBINATIONS ! 172: * ! 173: * The US English keyboard has 3 Modifier keys: ! 174: * Shift (left or right); Ctrl (left or right); and Alt (left or right). ! 175: * ! 176: * The only valid combinations of these Modifier Keys are: ! 177: * none pressed : Character at position (1) on the key. ! 178: * Shift : Character at position (2) on the key. ! 179: * Ctrl : Ascii Control characters ! 180: * Shift + Ctrl : Ascii Control characters ! 181: * Alt : Character-by-number on the numpad ! 182: * ! 183: * The invalid combinations (that do not generate any characters) are: ! 184: * Shift + Alt ! 185: * Alt + Ctrl ! 186: * Shift + Alt + Ctrl ! 187: * ! 188: * Something (???) : ! 189: * ----------------- ! 190: * Modifier keys Character produced ! 191: * ------------------------- ------------------ ! 192: * 0 No shifter key depressed position 1 ! 193: * 1 Shift key is depressed position 2 ! 194: * 2 AltGr (r.h. Alt) depressed position 4 or 5 (whichever is marked) ! 195: * ! 196: * However, note that 3 shifter keys (SHIFT, can be combined in a ! 197: * characters, depending on the Keyboards ! 198: * Consider the following keyboards: ! 199: * ! 200: * .-------. STRANGE KBD PECULIAR KBD ! 201: * /| |\ ================== ================== ! 202: * : | 2 4 | : 1 - ! 203: * | | | | 2 - SHIFT SHIFT ! 204: * | | | | 3 - MENU MENU ! 205: * | | 1 3 | | 4 - SHIFT + MENU SHIFT + MENU ! 206: * | |_______| | 5 - no such keys CTRL + MENU ! 207: * | / \ | ! 208: * |/ 5 \| ! 209: * `-----------' ! 210: * Both STRANGE and PECULIAR keyboards could have aVkToBits[] = ! 211: * { VK_SHIFT , KBDSHIFT }, // 0x01 ! 212: * { VK_CONTROL, KBDCTRL }, // 0x02 ! 213: * { VK_MENU , KBDALT }, // 0x04 ! 214: * { 0, 0 } ! 215: * ! 216: * The STRANGE keyboard has 4 distinct shift states, while the PECULIAR kbd ! 217: * has 5. However, note that 3 shifter bits can be combined in a ! 218: * total of 2^3 == 8 ways. Each such combination must be related to one (or ! 219: * none) of the enumerated shift states. ! 220: * Each shifter key combination can be represented by three binary bits: ! 221: * Bit 0 is set if VK_SHIFT is down ! 222: * Bit 1 is set if VK_CONTROL is down ! 223: * Bit 2 is set if VK_MENU is down ! 224: * ! 225: * Example: If the STRANGE keyboard generates no characters in combination ! 226: * when just the ALT key is held down, nor when the SHIFT, CTRL and ALT keys ! 227: * are all held down, then the tables might look like this: ! 228: * ! 229: * VK_MENU, ! 230: * VK_CTRL, 0 ! 231: * }; ! 232: * aModification[] = { ! 233: * 0, // 0 0 0 = 000 <none> ! 234: * 1, // 0 0 1 = 001 SHIFT ! 235: * SHFT_INVALID, // 0 1 0 = 010 ALT ! 236: * 2, // 0 1 1 = 011 SHIFT ALT ! 237: * 3, // 1 0 0 = 100 CTRL ! 238: * 4, // 1 0 1 = 101 SHIFT CTRL ! 239: * 5, // 1 1 0 = 110 CTRL ALT ! 240: * SHFT_INVALID // 1 1 1 = 111 SHIFT CTRL ALT ! 241: * }; ! 242: * ! 243: * ! 244: \***************************************************************************/ ! 245: ! 246: /***************************************************************************\ ! 247: * VK_TO_BIT - associate a Virtual Key with a Modifier bitmask. ! 248: * ! 249: * Vk - the Virtual key (eg: VK_SHIFT, VK_RMENU, VK_CONTROL etc.) ! 250: * Special Values: ! 251: * 0 null terminator ! 252: * ModBits - a combination of KBDALT, KBDCTRL, KBDSHIFT and kbd-specific bits ! 253: * Any kbd-specific shift bits must be the lowest-order bits other ! 254: * than KBDSHIFT, KBDCTRL and KBDALT (0, 1 & 2) ! 255: * ! 256: * Those languages that use AltGr (VK_RMENU) to shift keys convert it to ! 257: * CTRL+ALT with the KBDSPECIAL bit in the ausVK[] entry for VK_RMENU ! 258: * and by having an entry in aVkToPfnOem[] to simulate the right Vk sequence. ! 259: * ! 260: \***************************************************************************/ ! 261: typedef struct { ! 262: BYTE Vk; ! 263: BYTE ModBits; ! 264: } VK_TO_BIT, *PVK_TO_BIT; ! 265: ! 266: /***************************************************************************\ ! 267: * pModNumber - a table to map shift bits to enumerated shift states ! 268: * ! 269: * Table attributes: Ordered table ! 270: * ! 271: * Maps all possible shifter key combinations to an enumerated shift state. ! 272: * The size of the table depends on the value of the highest order bit used ! 273: * in aCharModifiers[*].ModBits ! 274: * ! 275: * Special values for aModification[*] ! 276: * SHFT_INVALID - no characters produced with this shift state. ! 277: LATER: (ianja) no SHFT_CTRL - control characters encoded in tables like others ! 278: * SHFT_CTRL - standard control character production (all keyboards must ! 279: * be able to produce CTRL-C == 0x0003 etc.) ! 280: * Other - enumerated shift state (not less than 0) ! 281: * ! 282: * This table is indexed by the Modifier Bits to obtain an Modification Number. ! 283: * ! 284: * CONTROL MENU SHIFT ! 285: * ! 286: * aModification[] = { ! 287: * 0, // 0 0 0 = 000 <none> ! 288: * 1, // 0 0 1 = 001 SHIFT ! 289: * SHFT_INVALID, // 0 1 0 = 010 ALT ! 290: * 2, // 0 1 1 = 011 SHIFT ALT ! 291: * 3, // 1 0 0 = 100 CTRL ! 292: * 4, // 1 0 1 = 101 SHIFT CTRL ! 293: * 5, // 1 1 0 = 110 CTRL ALT ! 294: * SHFT_INVALID // 1 1 1 = 111 SHIFT CTRL ALT ! 295: * }; ! 296: * ! 297: \***************************************************************************/ ! 298: typedef struct { ! 299: PVK_TO_BIT pVkToBit; // Virtual Keys -> Mod bits ! 300: WORD wMaxModBits; // max Modification bit combination value ! 301: BYTE ModNumber[]; // Mod bits -> Modification Number ! 302: } MODIFIERS, *PMODIFIERS; ! 303: ! 304: WORD GetModifierBits(PMODIFIERS pModifiers, LPBYTE afKeyState); ! 305: WORD GetModificationNumber(PMODIFIERS pModifiers, WORD wModBits); ! 306: ! 307: #define SHFT_INVALID 0x0F ! 308: ! 309: /***************************************************************************\ ! 310: * apulCvt_VK[] - obtain VK translation table from shift state ! 311: * A VK translation table is used to change the value of the Virtual Key ! 312: * according to the shift state. OEM only (not locale-specific) ! 313: \***************************************************************************/ ! 314: extern PULONG *gapulCvt_VK; ! 315: extern ULONG *gapulCvt_VK_101[]; ! 316: extern ULONG *gapulCvt_VK_84[]; ! 317: ! 318: /***************************************************************************\ ! 319: * awNumPadCvt[] - Translate cursor movement keys to numpad keys ! 320: \***************************************************************************/ ! 321: extern MODIFIERS Modifiers_VK; ! 322: extern BYTE aVkNumpad[]; ! 323: ! 324: /***************************************************************************\ ! 325: * VSC_VK - Associate a Virtual Scancode with a Virtual Key ! 326: * Vsc - Virtual Scancode ! 327: * Vk - Virtual Key | flags ! 328: * Used by VKFromVSC() for scancodes prefixed 0xE0 or 0xE1 ! 329: \***************************************************************************/ ! 330: typedef struct VSC_VK { ! 331: BYTE Vsc; ! 332: USHORT Vk; ! 333: } VSC_VK, *PVSC_VK; ! 334: ! 335: /***************************************************************************\ ! 336: * VK_VSC - Associate a Virtual Key with a Virtual Scancode ! 337: * Vk - Virtual Key ! 338: * Vsc - Virtual Scancode ! 339: * Used by MapVirtualKey for Virtual Keys not appearing in ausVK[] ! 340: \***************************************************************************/ ! 341: typedef struct VK_VSC { ! 342: BYTE Vk; ! 343: BYTE Vsc; ! 344: } VK_VSC, *PVK_VSC; ! 345: ! 346: /***************************************************************************\ ! 347: * ! 348: * VK_TO_WCHARS<n> - Associate a Virtual Key with <n> UNICODE characters ! 349: * ! 350: * VirtualKey - The Virtual Key. ! 351: * wch[] - An array of characters, one for each shift state that ! 352: * applies to the specified Virtual Key. ! 353: * ! 354: * Special values for VirtualKey: ! 355: * -1 - This entry contains dead chars for the previous entry ! 356: * 0 - Terminates a VK_TO_WCHARS[] table ! 357: * ! 358: * Special values for Attributes: ! 359: * CAPLOK - The CAPS-LOCK/SHIFT-LOCK key affects this key like SHIFT ! 360: * ! 361: * Special values for wch[*]: ! 362: * WCH_NONE - No character is generated by pressing this key with the ! 363: * current shift state. ! 364: * WCH_DEAD - The character is a dead-key: the next VK_TO_WCHARS[] entry ! 365: * will contain the values of the dead characters (diaresis) ! 366: * that can be produced by the Virtual Key. ! 367: * ! 368: \***************************************************************************/ ! 369: #define WCH_NONE 0xF000 ! 370: #define WCH_DEAD 0xF001 ! 371: ! 372: #define CAPLOK 0x01 ! 373: ! 374: /* ! 375: * Macro for VK to WCHAR with "n" shift states ! 376: */ ! 377: #define TYPEDEF_VK_TO_WCHARS(n) typedef struct _VK_TO_WCHARS##n { \ ! 378: BYTE VirtualKey; \ ! 379: BYTE Attributes; \ ! 380: WCHAR wch[n]; \ ! 381: } VK_TO_WCHARS##n, *PVK_TO_WCHARS##n; ! 382: ! 383: /* ! 384: * To facilitate coding the table scanning routine. ! 385: */ ! 386: ! 387: /* ! 388: * Table element types (for various numbers of shift states), used ! 389: * to facilitate static initializations of tables. ! 390: * VK_TO_WCHARS1 and PVK_TO_WCHARS1 may be used as the generic type ! 391: */ ! 392: TYPEDEF_VK_TO_WCHARS(1) // VK_TO_WCHARS1, *PVK_TO_WCHARS1; ! 393: TYPEDEF_VK_TO_WCHARS(2) // VK_TO_WCHARS2, *PVK_TO_WCHARS2; ! 394: TYPEDEF_VK_TO_WCHARS(3) // VK_TO_WCHARS3, *PVK_TO_WCHARS3; ! 395: TYPEDEF_VK_TO_WCHARS(4) // VK_TO_WCHARS4, *PVK_TO_WCHARS4; ! 396: TYPEDEF_VK_TO_WCHARS(5) // VK_TO_WCHARS5, *PVK_TO_WCHARS5; ! 397: TYPEDEF_VK_TO_WCHARS(6) // VK_TO_WCHARS6, *PVK_TO_WCHARS5; ! 398: ! 399: /***************************************************************************\ ! 400: * ! 401: * VK_TO_WCHAR_TABLE - Describe a table of VK_TO_WCHARS1 ! 402: * ! 403: * pVkToWchars - points to the table. ! 404: * nModifications - the number of shift-states supported by this table. ! 405: * (this is the number of elements in pVkToWchars[*].wch[]) ! 406: * ! 407: * A keyboard may have several such tables: all keys with the same number of ! 408: * shift-states are grouped together in one table. ! 409: * ! 410: * Special values for pVktoWchars: ! 411: * NULL - Terminates a VK_TO_WCHAR_TABLE[] list. ! 412: * ! 413: \***************************************************************************/ ! 414: ! 415: typedef struct _VK_TO_WCHAR_TABLE { ! 416: PVK_TO_WCHARS1 pVkToWchars; ! 417: BYTE nModifications; ! 418: BYTE cbSize; ! 419: } VK_TO_WCHAR_TABLE, *PVK_TO_WCHAR_TABLE; ! 420: ! 421: /***************************************************************************\ ! 422: * ! 423: * Dead Key (diaresis) tables ! 424: * ! 425: * LATER IanJa: supplant by an NLS API that composes Diacritic+Base -> WCHAR ! 426: * ! 427: \***************************************************************************/ ! 428: typedef struct { ! 429: DWORD dwBoth; // diacritic & char ! 430: WCHAR wchComposed; ! 431: } DEADKEY, *PDEADKEY; ! 432: ! 433: #define DEADTRANS(ch, accent, comp) { MAKELONG(ch, accent), comp} ! 434: ! 435: /***************************************************************************\ ! 436: * VSC_LPWSTR - associate a Virtual Scancode with a Text string ! 437: * ! 438: * Uses: ! 439: * GetKeyNameText(), aKeyNames[] Map virtual scancode to name of key ! 440: * ! 441: \***************************************************************************/ ! 442: typedef struct { ! 443: BYTE vsc; ! 444: LPWSTR pwsz; ! 445: } VSC_LPWSTR, *PVSC_LPWSTR; ! 446: ! 447: /***************************************************************************\ ! 448: * ! 449: * VK_F - associate a Virtual Key with a bitmask ! 450: * ! 451: * Uses: ! 452: * Special handle of Virtual Keys - fake different VK sequences ! 453: * ! 454: * Vk - A virtual key that is to produce key event simulation. ! 455: * fKEProc - A bitmask identifying the Key Event simulator procedure(s) to use. ! 456: * The postion of each set bit is an index into a table of procedure ! 457: * addresses. Using a bitmask here allows one key to have more than ! 458: * one Key Event simulator procedure. ! 459: * ! 460: \***************************************************************************/ ! 461: typedef struct { ! 462: BYTE Vk; ! 463: BYTE fKEProc; ! 464: } VK_F, *PVK_F; ! 465: ! 466: #define KLLF_ALTGR 0x00000001 ! 467: ! 468: /***************************************************************************\ ! 469: * KBDTABLES ! 470: * ! 471: * This structure describes all the tables that implement the keyboard layer. ! 472: * ! 473: * When switching to a new layer, we get a new KBDTABLES structure: all key ! 474: * processing tables are accessed indirectly through this structure. ! 475: * ! 476: \***************************************************************************/ ! 477: ! 478: typedef struct tagKbdLayer { ! 479: /* ! 480: * Modifier keys ! 481: */ ! 482: PMODIFIERS pCharModifiers; ! 483: ! 484: /* ! 485: * Characters ! 486: */ ! 487: VK_TO_WCHAR_TABLE *pVkToWcharTable; // ptr to tbl of ptrs to tbl ! 488: ! 489: /* ! 490: * Diacritics ! 491: */ ! 492: PDEADKEY pDeadKey; ! 493: ! 494: /* ! 495: * Names of Keys ! 496: */ ! 497: VSC_LPWSTR *pKeyNames; ! 498: VSC_LPWSTR *pKeyNamesExt; ! 499: LPWSTR *pKeyNamesDead; ! 500: ! 501: /* ! 502: * Scan codes to Virtual Keys ! 503: */ ! 504: USHORT *pusVSCtoVK; ! 505: BYTE bMaxVSCtoVK; ! 506: PVSC_VK pVSCtoVK_E0; // Scancode has E0 prefix ! 507: PVSC_VK pVSCtoVK_E1; // Scancode has E1 prefix ! 508: ! 509: /* ! 510: * Locale-specific special processing ! 511: */ ! 512: DWORD fLocaleFlags; ! 513: } KBDTABLES, *PKBDTABLES; ! 514: ! 515: /* ! 516: * OEM-specific special processing (keystroke simulators and filters) ! 517: */ ! 518: extern VK_F aVkToFOEM[]; ! 519: extern KEPROC aKEProcOEM[]; ! 520: ! 521: /***************************************************************************\ ! 522: * Macros for ausVK[] values (used below) ! 523: * ! 524: * These macros prefix each argument with VK_ to produce the name of a Virtual ! 525: * Key defined in "winuser.h" (eg: ESCAPE becomes VK_ESCAPE). ! 526: \***************************************************************************/ ! 527: #ifndef KBD_TYPE ! 528: #define KBD_TYPE 4 ! 529: #endif ! 530: ! 531: /* ! 532: * _NE() selects the Virtual Key according to keyboard type ! 533: */ ! 534: #if (KBD_TYPE == 1) ! 535: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v1) ! 536: #elif (KBD_TYPE == 2) ! 537: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v2) ! 538: #elif (KBD_TYPE == 3) ! 539: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v3) ! 540: #elif (KBD_TYPE == 4) ! 541: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v4) ! 542: #elif (KBD_TYPE == 5) ! 543: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v5) ! 544: #elif (KBD_TYPE == 6) ! 545: #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v6) ! 546: #endif ! 547: ! 548: /* ! 549: * _EQ() selects the same Virtual Key for all keyboard types ! 550: */ ! 551: #define _EQ( v4 ) (VK_##v4) ! 552: ! 553: /* ! 554: * A bit of trickery for virtual key names 'A' to 'Z' and '0' to '9' so ! 555: * that they are not converted to a VK_* name. ! 556: * With this macro, VK_'A' equates to 'A' etc. ! 557: */ ! 558: #define VK_ ! 559: #define VK__none_ 0xFF ! 560: ! 561: /***************************************************************************\ ! 562: * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion) ! 563: * ! 564: * These values are for Scancode Set 3 and the USA. ! 565: * Other languages substitute their own values where required (files kbd**.h) ! 566: * ! 567: * Six sets of keyboards are supported, according to KBD_TYPE: ! 568: * ! 569: * KBD_TYPE Keyboard (examples) ! 570: * ======== ======================================================= ! 571: * 1 AT&T '301' & '302'; Olivetti 83-key; PC-XT 84-key; etc. ! 572: * 2 Olivetti M24 102-key ! 573: * 3 HP Vectra (DIN); Olivetti 86-key; etc. ! 574: * 4 * Enhanced 101/102-key; Olivetti A; etc. ! 575: * 5 Nokia (Ericsson) type 5 (1050, etc.) ! 576: * 6 Nokia (Ericsson) type 6 (9140) ! 577: * ! 578: * * If KBD_TYPE is not defined, the default is type 4. ! 579: * ! 580: * _EQ() : all keyboard types have the same virtual key for this scancode ! 581: * _NE() : different virtual keys for this scancode, depending on kbd type ! 582: * ! 583: * +------+ +--------+--------+--------+--------+--------+--------+ ! 584: * | Scan | | kbd | kbd | kbd | kbd | kbd | kbd | ! 585: * | code | | type 1 | type 2 | type 3 | type 4 | type 5 | type 6 | ! 586: \****+-------+-+--------+--------+--------+--------+--------+--------+******/ ! 587: ! 588: #define T00 _EQ( _none_ ) ! 589: #define T01 _EQ( ESCAPE ) ! 590: #define T02 _EQ( '1' ) ! 591: #define T03 _EQ( '2' ) ! 592: #define T04 _EQ( '3' ) ! 593: #define T05 _EQ( '4' ) ! 594: #define T06 _EQ( '5' ) ! 595: #define T07 _EQ( '6' ) ! 596: #define T08 _EQ( '7' ) ! 597: #define T09 _EQ( '8' ) ! 598: #define T0A _EQ( '9' ) ! 599: #define T0B _EQ( '0' ) ! 600: #define T0C _EQ( OEM_MINUS ) ! 601: #define T0D _NE(OEM_PLUS,OEM_4, OEM_PLUS,OEM_PLUS,OEM_PLUS,OEM_PLUS) ! 602: #define T0E _EQ( BACK ) ! 603: #define T0F _EQ( TAB ) ! 604: #define T10 _EQ( 'Q' ) ! 605: #define T11 _EQ( 'W' ) ! 606: #define T12 _EQ( 'E' ) ! 607: #define T13 _EQ( 'R' ) ! 608: #define T14 _EQ( 'T' ) ! 609: #define T15 _EQ( 'Y' ) ! 610: #define T16 _EQ( 'U' ) ! 611: #define T17 _EQ( 'I' ) ! 612: #define T18 _EQ( 'O' ) ! 613: #define T19 _EQ( 'P' ) ! 614: #define T1A _NE(OEM_4, OEM_6, OEM_4, OEM_4, OEM_4, OEM_4 ) ! 615: #define T1B _NE(OEM_6, OEM_1, OEM_6, OEM_6, OEM_6, OEM_6 ) ! 616: #define T1C _EQ( RETURN ) ! 617: #define T1D _EQ( LCONTROL ) ! 618: #define T1E _EQ( 'A' ) ! 619: #define T1F _EQ( 'S' ) ! 620: #define T20 _EQ( 'D' ) ! 621: #define T21 _EQ( 'F' ) ! 622: #define T22 _EQ( 'G' ) ! 623: #define T23 _EQ( 'H' ) ! 624: #define T24 _EQ( 'J' ) ! 625: #define T25 _EQ( 'K' ) ! 626: #define T26 _EQ( 'L' ) ! 627: #define T27 _NE(OEM_1, OEM_PLUS,OEM_1, OEM_1, OEM_1, OEM_1 ) ! 628: #define T28 _NE(OEM_7, OEM_3, OEM_7, OEM_7, OEM_3, OEM_3 ) ! 629: #define T29 _NE(OEM_3, OEM_7, OEM_3, OEM_3, OEM_7, OEM_7 ) ! 630: #define T2A _EQ( LSHIFT ) ! 631: #define T2B _EQ( OEM_5 ) ! 632: #define T2C _EQ( 'Z' ) ! 633: #define T2D _EQ( 'X' ) ! 634: #define T2E _EQ( 'C' ) ! 635: #define T2F _EQ( 'V' ) ! 636: #define T30 _EQ( 'B' ) ! 637: #define T31 _EQ( 'N' ) ! 638: #define T32 _EQ( 'M' ) ! 639: #define T33 _EQ( OEM_COMMA ) ! 640: #define T34 _EQ( OEM_PERIOD ) ! 641: #define T35 _EQ( OEM_2 ) ! 642: #define T36 _EQ( RSHIFT ) ! 643: #define T37 _EQ( MULTIPLY ) ! 644: #define T38 _EQ( LMENU ) ! 645: #define T39 _EQ( ' ' ) ! 646: #define T3A _EQ( CAPITAL ) ! 647: #define T3B _EQ( F1 ) ! 648: #define T3C _EQ( F2 ) ! 649: #define T3D _EQ( F3 ) ! 650: #define T3E _EQ( F4 ) ! 651: #define T3F _EQ( F5 ) ! 652: #define T40 _EQ( F6 ) ! 653: #define T41 _EQ( F7 ) ! 654: #define T42 _EQ( F8 ) ! 655: #define T43 _EQ( F9 ) ! 656: #define T44 _EQ( F10 ) ! 657: #define T45 _EQ( NUMLOCK ) ! 658: #define T46 _EQ( OEM_SCROLL ) ! 659: #define T47 _EQ( HOME ) ! 660: #define T48 _EQ( UP ) ! 661: #define T49 _EQ( PRIOR ) ! 662: #define T4A _EQ( SUBTRACT ) ! 663: #define T4B _EQ( LEFT ) ! 664: #define T4C _EQ( CLEAR ) ! 665: #define T4D _EQ( RIGHT ) ! 666: #define T4E _EQ( ADD ) ! 667: #define T4F _EQ( END ) ! 668: #define T50 _EQ( DOWN ) ! 669: #define T51 _EQ( NEXT ) ! 670: #define T52 _EQ( INSERT ) ! 671: #define T53 _EQ( DELETE ) ! 672: #define T54 _EQ( SNAPSHOT ) ! 673: #define T55 _EQ( _none_ ) ! 674: #define T56 _NE(OEM_102, HELP, OEM_102, OEM_102, _none_, OEM_PA2 ) ! 675: #define T57 _NE(F11, RETURN, F11, F11, _none_, HELP ) ! 676: #define T58 _NE(F12, LEFT, F12, F12, _none_, OEM_102 ) ! 677: #define T59 _EQ( CLEAR ) ! 678: #define T5A _EQ( NONAME )// WSCtrl ! 679: #define T5B _EQ( NONAME )// Finish ! 680: #define T5C _EQ( NONAME )// Jump ! 681: #define T5D _EQ( EREOF ) ! 682: #define T5E _EQ( _none_ ) ! 683: #define T5F _EQ( NONAME ) ! 684: #define T60 _EQ( _none_ ) ! 685: #define T61 _EQ( _none_ ) ! 686: #define T62 _EQ( _none_ ) ! 687: #define T63 _EQ( _none_ ) ! 688: #define T64 _EQ( F13 ) ! 689: #define T65 _EQ( F14 ) ! 690: #define T66 _EQ( F15 ) ! 691: #define T67 _EQ( F16 ) ! 692: #define T68 _EQ( F17 ) ! 693: #define T69 _EQ( F18 ) ! 694: #define T6A _EQ( F19 ) ! 695: #define T6B _EQ( F20 ) ! 696: #define T6C _EQ( F21 ) ! 697: #define T6D _EQ( F22 ) ! 698: #define T6E _EQ( F23 ) ! 699: #define T6F _EQ( _none_ ) ! 700: #define T70 _EQ( _none_ ) ! 701: #define T71 _EQ( _none_ ) ! 702: #define T72 _EQ( _none_ ) ! 703: #define T73 _EQ( _none_ ) ! 704: #define T74 _EQ( _none_ ) ! 705: #define T75 _EQ( _none_ ) ! 706: #define T76 _EQ( F24 ) ! 707: #define T77 _EQ( _none_ ) ! 708: #define T78 _EQ( _none_ ) ! 709: #define T79 _EQ( _none_ ) ! 710: #define T7A _EQ( _none_ ) ! 711: #define T7B _EQ( _none_ ) ! 712: #define T7C _EQ( TAB ) ! 713: ! 714: #define X1C _EQ( RETURN ) ! 715: #define X1D _EQ( RCONTROL ) ! 716: #define X35 _EQ( DIVIDE ) ! 717: #define X37 _EQ( SNAPSHOT ) ! 718: #define X38 _EQ( RMENU ) ! 719: #define X46 _EQ( CANCEL ) ! 720: #define X47 _EQ( HOME ) ! 721: #define X48 _EQ( UP ) ! 722: #define X49 _EQ( PRIOR ) ! 723: #define X4B _EQ( LEFT ) ! 724: #define X4D _EQ( RIGHT ) ! 725: #define X4F _EQ( END ) ! 726: #define X50 _EQ( DOWN ) ! 727: #define X51 _NE(NEXT, F1, NEXT, NEXT, _none_, OEM_PA2 ) ! 728: #define X52 _EQ( INSERT ) ! 729: #define X53 _EQ( DELETE ) ! 730: ! 731: /* ! 732: * The break key is sent to us as E1,LCtrl,NumLock ! 733: * We must conevrt the E1+LCtrl to BREAK, then ignore the Numlock ! 734: * which must be ignored. Alternatively, translate Ctrl-Numlock ! 735: * to break, but don't let the CTRL through as a WM_KEYUP/DOWN) ? ! 736: */ ! 737: #define Y1D _EQ( PAUSE ) ! 738: ! 739: #define SCANCODE_LSHIFT 0x2A ! 740: #define SCANCODE_RSHIFT 0x36 ! 741: #define SCANCODE_SIMULATED (FAKE_KEYSTROKE >> 16) ! 742: ! 743: #define SCANCODE_NUMPAD_FIRST 0x47 ! 744: #define SCANCODE_NUMPAD_LAST 0x52 ! 745: ! 746: #endif // _KBD_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.