cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

input.h (28501B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Input Functions
      4 *
      5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef WINPR_INPUT_H
     21#define WINPR_INPUT_H
     22
     23#include <winpr/winpr.h>
     24#include <winpr/wtypes.h>
     25
     26/**
     27 * Key Flags
     28 */
     29
     30#define KBDEXT (USHORT)0x0100
     31#define KBDMULTIVK (USHORT)0x0200
     32#define KBDSPECIAL (USHORT)0x0400
     33#define KBDNUMPAD (USHORT)0x0800
     34#define KBDUNICODE (USHORT)0x1000
     35#define KBDINJECTEDVK (USHORT)0x2000
     36#define KBDMAPPEDVK (USHORT)0x4000
     37#define KBDBREAK (USHORT)0x8000
     38
     39/*
     40 * Virtual Key Codes (Windows):
     41 * http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731/
     42 * http://msdn.microsoft.com/en-us/library/ms927178.aspx
     43 */
     44
     45/* Mouse buttons */
     46
     47#define VK_LBUTTON 0x01  /* Left mouse button */
     48#define VK_RBUTTON 0x02  /* Right mouse button */
     49#define VK_CANCEL 0x03   /* Control-break processing */
     50#define VK_MBUTTON 0x04  /* Middle mouse button (three-button mouse) */
     51#define VK_XBUTTON1 0x05 /* Windows 2000/XP: X1 mouse button */
     52#define VK_XBUTTON2 0x06 /* Windows 2000/XP: X2 mouse button */
     53
     54/* 0x07 is undefined */
     55
     56#define VK_BACK 0x08 /* BACKSPACE key */
     57#define VK_TAB 0x09  /* TAB key */
     58
     59/* 0x0A to 0x0B are reserved */
     60
     61#define VK_CLEAR 0x0C  /* CLEAR key */
     62#define VK_RETURN 0x0D /* ENTER key */
     63
     64/* 0x0E to 0x0F are undefined */
     65
     66#define VK_SHIFT 0x10   /* SHIFT key */
     67#define VK_CONTROL 0x11 /* CTRL key */
     68#define VK_MENU 0x12    /* ALT key */
     69#define VK_PAUSE 0x13   /* PAUSE key */
     70#define VK_CAPITAL 0x14 /* CAPS LOCK key */
     71#define VK_KANA 0x15    /* Input Method Editor (IME) Kana mode */
     72#define VK_HANGUEL                                                                               \
     73	0x15               /* IME Hanguel mode (maintained for compatibility; use #define VK_HANGUL) \
     74	                    */
     75#define VK_HANGUL 0x15 /* IME Hangul mode */
     76
     77/* 0x16 is undefined */
     78
     79#define VK_JUNJA 0x17 /* IME Junja mode */
     80#define VK_FINAL 0x18 /* IME final mode */
     81#define VK_HANJA 0x19 /* IME Hanja mode */
     82#define VK_KANJI 0x19 /* IME Kanji mode */
     83
     84/* 0x1A is undefined, use it for missing Hiragana/Katakana Toggle */
     85
     86#define VK_HKTG 0x1A       /* Hiragana/Katakana toggle */
     87#define VK_ESCAPE 0x1B     /* ESC key */
     88#define VK_CONVERT 0x1C    /* IME convert */
     89#define VK_NONCONVERT 0x1D /* IME nonconvert */
     90#define VK_ACCEPT 0x1E     /* IME accept */
     91#define VK_MODECHANGE 0x1F /* IME mode change request */
     92
     93#define VK_SPACE 0x20    /* SPACEBAR */
     94#define VK_PRIOR 0x21    /* PAGE UP key */
     95#define VK_NEXT 0x22     /* PAGE DOWN key */
     96#define VK_END 0x23      /* END key */
     97#define VK_HOME 0x24     /* HOME key */
     98#define VK_LEFT 0x25     /* LEFT ARROW key */
     99#define VK_UP 0x26       /* UP ARROW key */
    100#define VK_RIGHT 0x27    /* RIGHT ARROW key */
    101#define VK_DOWN 0x28     /* DOWN ARROW key */
    102#define VK_SELECT 0x29   /* SELECT key */
    103#define VK_PRINT 0x2A    /* PRINT key */
    104#define VK_EXECUTE 0x2B  /* EXECUTE key */
    105#define VK_SNAPSHOT 0x2C /* PRINT SCREEN key */
    106#define VK_INSERT 0x2D   /* INS key */
    107#define VK_DELETE 0x2E   /* DEL key */
    108#define VK_HELP 0x2F     /* HELP key */
    109
    110/* Digits, the last 4 bits of the code represent the corresponding digit */
    111
    112#define VK_KEY_0 0x30 /* '0' key */
    113#define VK_KEY_1 0x31 /* '1' key */
    114#define VK_KEY_2 0x32 /* '2' key */
    115#define VK_KEY_3 0x33 /* '3' key */
    116#define VK_KEY_4 0x34 /* '4' key */
    117#define VK_KEY_5 0x35 /* '5' key */
    118#define VK_KEY_6 0x36 /* '6' key */
    119#define VK_KEY_7 0x37 /* '7' key */
    120#define VK_KEY_8 0x38 /* '8' key */
    121#define VK_KEY_9 0x39 /* '9' key */
    122
    123/* 0x3A to 0x40 are undefined */
    124
    125/* The alphabet, the code corresponds to the capitalized letter in the ASCII code */
    126
    127#define VK_KEY_A 0x41 /* 'A' key */
    128#define VK_KEY_B 0x42 /* 'B' key */
    129#define VK_KEY_C 0x43 /* 'C' key */
    130#define VK_KEY_D 0x44 /* 'D' key */
    131#define VK_KEY_E 0x45 /* 'E' key */
    132#define VK_KEY_F 0x46 /* 'F' key */
    133#define VK_KEY_G 0x47 /* 'G' key */
    134#define VK_KEY_H 0x48 /* 'H' key */
    135#define VK_KEY_I 0x49 /* 'I' key */
    136#define VK_KEY_J 0x4A /* 'J' key */
    137#define VK_KEY_K 0x4B /* 'K' key */
    138#define VK_KEY_L 0x4C /* 'L' key */
    139#define VK_KEY_M 0x4D /* 'M' key */
    140#define VK_KEY_N 0x4E /* 'N' key */
    141#define VK_KEY_O 0x4F /* 'O' key */
    142#define VK_KEY_P 0x50 /* 'P' key */
    143#define VK_KEY_Q 0x51 /* 'Q' key */
    144#define VK_KEY_R 0x52 /* 'R' key */
    145#define VK_KEY_S 0x53 /* 'S' key */
    146#define VK_KEY_T 0x54 /* 'T' key */
    147#define VK_KEY_U 0x55 /* 'U' key */
    148#define VK_KEY_V 0x56 /* 'V' key */
    149#define VK_KEY_W 0x57 /* 'W' key */
    150#define VK_KEY_X 0x58 /* 'X' key */
    151#define VK_KEY_Y 0x59 /* 'Y' key */
    152#define VK_KEY_Z 0x5A /* 'Z' key */
    153
    154#define VK_LWIN 0x5B /* Left Windows key (Microsoft Natural keyboard) */
    155#define VK_RWIN 0x5C /* Right Windows key (Natural keyboard) */
    156#define VK_APPS 0x5D /* Applications key (Natural keyboard) */
    157
    158/* 0x5E is reserved */
    159
    160#define VK_POWER 0x5E /* Power key */
    161
    162#define VK_SLEEP 0x5F /* Computer Sleep key */
    163
    164/* Numeric keypad digits, the last four bits of the code represent the corresponding digit */
    165
    166#define VK_NUMPAD0 0x60 /* Numeric keypad '0' key */
    167#define VK_NUMPAD1 0x61 /* Numeric keypad '1' key */
    168#define VK_NUMPAD2 0x62 /* Numeric keypad '2' key */
    169#define VK_NUMPAD3 0x63 /* Numeric keypad '3' key */
    170#define VK_NUMPAD4 0x64 /* Numeric keypad '4' key */
    171#define VK_NUMPAD5 0x65 /* Numeric keypad '5' key */
    172#define VK_NUMPAD6 0x66 /* Numeric keypad '6' key */
    173#define VK_NUMPAD7 0x67 /* Numeric keypad '7' key */
    174#define VK_NUMPAD8 0x68 /* Numeric keypad '8' key */
    175#define VK_NUMPAD9 0x69 /* Numeric keypad '9' key */
    176
    177/* Numeric keypad operators and special keys */
    178
    179#define VK_MULTIPLY 0x6A  /* Multiply key */
    180#define VK_ADD 0x6B       /* Add key */
    181#define VK_SEPARATOR 0x6C /* Separator key */
    182#define VK_SUBTRACT 0x6D  /* Subtract key */
    183#define VK_DECIMAL 0x6E   /* Decimal key */
    184#define VK_DIVIDE 0x6F    /* Divide key */
    185
    186/* Function keys, from F1 to F24 */
    187
    188#define VK_F1 0x70  /* F1 key */
    189#define VK_F2 0x71  /* F2 key */
    190#define VK_F3 0x72  /* F3 key */
    191#define VK_F4 0x73  /* F4 key */
    192#define VK_F5 0x74  /* F5 key */
    193#define VK_F6 0x75  /* F6 key */
    194#define VK_F7 0x76  /* F7 key */
    195#define VK_F8 0x77  /* F8 key */
    196#define VK_F9 0x78  /* F9 key */
    197#define VK_F10 0x79 /* F10 key */
    198#define VK_F11 0x7A /* F11 key */
    199#define VK_F12 0x7B /* F12 key */
    200#define VK_F13 0x7C /* F13 key */
    201#define VK_F14 0x7D /* F14 key */
    202#define VK_F15 0x7E /* F15 key */
    203#define VK_F16 0x7F /* F16 key */
    204#define VK_F17 0x80 /* F17 key */
    205#define VK_F18 0x81 /* F18 key */
    206#define VK_F19 0x82 /* F19 key */
    207#define VK_F20 0x83 /* F20 key */
    208#define VK_F21 0x84 /* F21 key */
    209#define VK_F22 0x85 /* F22 key */
    210#define VK_F23 0x86 /* F23 key */
    211#define VK_F24 0x87 /* F24 key */
    212
    213/* 0x88 to 0x8F are unassigned */
    214
    215#define VK_NUMLOCK 0x90 /* NUM LOCK key */
    216#define VK_SCROLL 0x91  /* SCROLL LOCK key */
    217
    218/* 0x92 to 0x96 are OEM specific */
    219/* 0x97 to 0x9F are unassigned */
    220
    221/* Modifier keys */
    222
    223#define VK_LSHIFT 0xA0   /* Left SHIFT key */
    224#define VK_RSHIFT 0xA1   /* Right SHIFT key */
    225#define VK_LCONTROL 0xA2 /* Left CONTROL key */
    226#define VK_RCONTROL 0xA3 /* Right CONTROL key */
    227#define VK_LMENU 0xA4    /* Left MENU key */
    228#define VK_RMENU 0xA5    /* Right MENU key */
    229
    230/* Browser related keys */
    231
    232#define VK_BROWSER_BACK 0xA6      /* Windows 2000/XP: Browser Back key */
    233#define VK_BROWSER_FORWARD 0xA7   /* Windows 2000/XP: Browser Forward key */
    234#define VK_BROWSER_REFRESH 0xA8   /* Windows 2000/XP: Browser Refresh key */
    235#define VK_BROWSER_STOP 0xA9      /* Windows 2000/XP: Browser Stop key */
    236#define VK_BROWSER_SEARCH 0xAA    /* Windows 2000/XP: Browser Search key */
    237#define VK_BROWSER_FAVORITES 0xAB /* Windows 2000/XP: Browser Favorites key */
    238#define VK_BROWSER_HOME 0xAC      /* Windows 2000/XP: Browser Start and Home key */
    239
    240/* Volume related keys */
    241
    242#define VK_VOLUME_MUTE 0xAD /* Windows 2000/XP: Volume Mute key */
    243#define VK_VOLUME_DOWN 0xAE /* Windows 2000/XP: Volume Down key */
    244#define VK_VOLUME_UP 0xAF   /* Windows 2000/XP: Volume Up key */
    245
    246/* Media player related keys */
    247
    248#define VK_MEDIA_NEXT_TRACK 0xB0 /* Windows 2000/XP: Next Track key */
    249#define VK_MEDIA_PREV_TRACK 0xB1 /* Windows 2000/XP: Previous Track key */
    250#define VK_MEDIA_STOP 0xB2       /* Windows 2000/XP: Stop Media key */
    251#define VK_MEDIA_PLAY_PAUSE 0xB3 /* Windows 2000/XP: Play/Pause Media key */
    252
    253/* Application launcher keys */
    254
    255#define VK_LAUNCH_MAIL 0xB4         /* Windows 2000/XP: Start Mail key */
    256#define VK_MEDIA_SELECT 0xB5        /* Windows 2000/XP: Select Media key */
    257#define VK_LAUNCH_MEDIA_SELECT 0xB5 /* Windows 2000/XP: Select Media key */
    258#define VK_LAUNCH_APP1 0xB6         /* Windows 2000/XP: Start Application 1 key */
    259#define VK_LAUNCH_APP2 0xB7         /* Windows 2000/XP: Start Application 2 key */
    260
    261/* 0xB8 and 0xB9 are reserved */
    262
    263/* OEM keys */
    264
    265#define VK_OEM_1 0xBA /* Used for miscellaneous characters; it can vary by keyboard. */
    266                      /* Windows 2000/XP: For the US standard keyboard, the ';:' key */
    267
    268#define VK_OEM_PLUS 0xBB   /* Windows 2000/XP: For any country/region, the '+' key */
    269#define VK_OEM_COMMA 0xBC  /* Windows 2000/XP: For any country/region, the ',' key */
    270#define VK_OEM_MINUS 0xBD  /* Windows 2000/XP: For any country/region, the '-' key */
    271#define VK_OEM_PERIOD 0xBE /* Windows 2000/XP: For any country/region, the '.' key */
    272
    273#define VK_OEM_2 0xBF /* Used for miscellaneous characters; it can vary by keyboard. */
    274                      /* Windows 2000/XP: For the US standard keyboard, the '/?' key */
    275
    276#define VK_OEM_3 0xC0 /* Used for miscellaneous characters; it can vary by keyboard. */
    277                      /* Windows 2000/XP: For the US standard keyboard, the '`~' key */
    278
    279/* 0xC1 to 0xD7 are reserved */
    280#define VK_ABNT_C1 0xC1 /* Brazilian (ABNT) Keyboard */
    281#define VK_ABNT_C2 0xC2 /* Brazilian (ABNT) Keyboard */
    282
    283/* 0xD8 to 0xDA are unassigned */
    284
    285#define VK_OEM_4 0xDB /* Used for miscellaneous characters; it can vary by keyboard. */
    286                      /* Windows 2000/XP: For the US standard keyboard, the '[{' key */
    287
    288#define VK_OEM_5 0xDC /* Used for miscellaneous characters; it can vary by keyboard. */
    289                      /* Windows 2000/XP: For the US standard keyboard, the '\|' key */
    290
    291#define VK_OEM_6 0xDD /* Used for miscellaneous characters; it can vary by keyboard. */
    292                      /* Windows 2000/XP: For the US standard keyboard, the ']}' key */
    293
    294#define VK_OEM_7 0xDE /* Used for miscellaneous characters; it can vary by keyboard. */
    295/* Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key */
    296
    297#define VK_OEM_8 0xDF /* Used for miscellaneous characters; it can vary by keyboard. */
    298
    299/* 0xE0 is reserved */
    300
    301#define VK_OEM_AX 0xE1 /* AX key on Japanese AX keyboard */
    302
    303#define VK_OEM_102 0xE2 /* Windows 2000/XP: Either the angle bracket key or */
    304                        /* the backslash key on the RT 102-key keyboard */
    305
    306/* 0xE3 and 0xE4 are OEM specific */
    307
    308#define VK_PROCESSKEY                                                          \
    309	0xE5 /* Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key \
    310	      */
    311
    312/* 0xE6 is OEM specific */
    313
    314#define VK_PACKET \
    315	0xE7 /* Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. */
    316/* The #define VK_PACKET key is the low word of a 32-bit Virtual Key value used */
    317/* for non-keyboard input methods. For more information, */
    318/* see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP */
    319
    320/* 0xE8 is unassigned */
    321/* 0xE9 to 0xF5 are OEM specific */
    322
    323#define VK_OEM_RESET 0xE9
    324#define VK_OEM_JUMP 0xEA
    325#define VK_OEM_PA1 0xEB
    326#define VK_OEM_PA2 0xEC
    327#define VK_OEM_PA3 0xED
    328#define VK_OEM_WSCTRL 0xEE
    329#define VK_OEM_CUSEL 0xEF
    330#define VK_OEM_ATTN 0xF0
    331#define VK_OEM_FINISH 0xF1
    332#define VK_OEM_COPY 0xF2
    333#define VK_OEM_AUTO 0xF3
    334#define VK_OEM_ENLW 0xF4
    335#define VK_OEM_BACKTAB 0xF5
    336
    337#define VK_ATTN 0xF6      /* Attn key */
    338#define VK_CRSEL 0xF7     /* CrSel key */
    339#define VK_EXSEL 0xF8     /* ExSel key */
    340#define VK_EREOF 0xF9     /* Erase EOF key */
    341#define VK_PLAY 0xFA      /* Play key */
    342#define VK_ZOOM 0xFB      /* Zoom key */
    343#define VK_NONAME 0xFC    /* Reserved */
    344#define VK_PA1 0xFD       /* PA1 key */
    345#define VK_OEM_CLEAR 0xFE /* Clear key */
    346
    347#define VK_NONE 0xFF /* no key */
    348
    349/**
    350 * For East Asian Input Method Editors (IMEs)
    351 * the following additional virtual keyboard definitions must be observed.
    352 */
    353
    354#define VK_DBE_ALPHANUMERIC 0xF0          /* Changes the mode to alphanumeric. */
    355#define VK_DBE_KATAKANA 0xF1              /* Changes the mode to Katakana. */
    356#define VK_DBE_HIRAGANA 0xF2              /* Changes the mode to Hiragana. */
    357#define VK_DBE_SBCSCHAR 0xF3              /* Changes the mode to single-byte characters. */
    358#define VK_DBE_DBCSCHAR 0xF4              /* Changes the mode to double-byte characters. */
    359#define VK_DBE_ROMAN 0xF5                 /* Changes the mode to Roman characters. */
    360#define VK_DBE_NOROMAN 0xF6               /* Changes the mode to non-Roman characters. */
    361#define VK_DBE_ENTERWORDREGISTERMODE 0xF7 /* Activates the word registration dialog box. */
    362#define VK_DBE_ENTERIMECONFIGMODE \
    363	0xF8                        /* Activates a dialog box for setting up an IME environment. */
    364#define VK_DBE_FLUSHSTRING 0xF9 /* Deletes the undetermined string without determining it. */
    365#define VK_DBE_CODEINPUT 0xFA   /* Changes the mode to code input. */
    366#define VK_DBE_NOCODEINPUT 0xFB /* Changes the mode to no-code input. */
    367
    368/*
    369 * Virtual Scan Codes
    370 */
    371
    372/**
    373 * Keyboard Type 4
    374 */
    375
    376#define KBD4_T00 VK_NONE
    377#define KBD4_T01 VK_ESCAPE
    378#define KBD4_T02 VK_KEY_1
    379#define KBD4_T03 VK_KEY_2
    380#define KBD4_T04 VK_KEY_3
    381#define KBD4_T05 VK_KEY_4
    382#define KBD4_T06 VK_KEY_5
    383#define KBD4_T07 VK_KEY_6
    384#define KBD4_T08 VK_KEY_7
    385#define KBD4_T09 VK_KEY_8
    386#define KBD4_T0A VK_KEY_9
    387#define KBD4_T0B VK_KEY_0
    388#define KBD4_T0C VK_OEM_MINUS
    389#define KBD4_T0D VK_OEM_PLUS /* NE */
    390#define KBD4_T0E VK_BACK
    391#define KBD4_T0F VK_TAB
    392#define KBD4_T10 VK_KEY_Q
    393#define KBD4_T11 VK_KEY_W
    394#define KBD4_T12 VK_KEY_E
    395#define KBD4_T13 VK_KEY_R
    396#define KBD4_T14 VK_KEY_T
    397#define KBD4_T15 VK_KEY_Y
    398#define KBD4_T16 VK_KEY_U
    399#define KBD4_T17 VK_KEY_I
    400#define KBD4_T18 VK_KEY_O
    401#define KBD4_T19 VK_KEY_P
    402#define KBD4_T1A VK_OEM_4 /* NE */
    403#define KBD4_T1B VK_OEM_6 /* NE */
    404#define KBD4_T1C VK_RETURN
    405#define KBD4_T1D VK_LCONTROL
    406#define KBD4_T1E VK_KEY_A
    407#define KBD4_T1F VK_KEY_S
    408#define KBD4_T20 VK_KEY_D
    409#define KBD4_T21 VK_KEY_F
    410#define KBD4_T22 VK_KEY_G
    411#define KBD4_T23 VK_KEY_H
    412#define KBD4_T24 VK_KEY_J
    413#define KBD4_T25 VK_KEY_K
    414#define KBD4_T26 VK_KEY_L
    415#define KBD4_T27 VK_OEM_1 /* NE */
    416#define KBD4_T28 VK_OEM_7 /* NE */
    417#define KBD4_T29 VK_OEM_3 /* NE */
    418#define KBD4_T2A VK_LSHIFT
    419#define KBD4_T2B VK_OEM_5
    420#define KBD4_T2C VK_KEY_Z
    421#define KBD4_T2D VK_KEY_X
    422#define KBD4_T2E VK_KEY_C
    423#define KBD4_T2F VK_KEY_V
    424#define KBD4_T30 VK_KEY_B
    425#define KBD4_T31 VK_KEY_N
    426#define KBD4_T32 VK_KEY_M
    427#define KBD4_T33 VK_OEM_COMMA
    428#define KBD4_T34 VK_OEM_PERIOD
    429#define KBD4_T35 VK_OEM_2
    430#define KBD4_T36 VK_RSHIFT
    431#define KBD4_T37 VK_MULTIPLY
    432#define KBD4_T38 VK_LMENU
    433#define KBD4_T39 VK_SPACE
    434#define KBD4_T3A VK_CAPITAL
    435#define KBD4_T3B VK_F1
    436#define KBD4_T3C VK_F2
    437#define KBD4_T3D VK_F3
    438#define KBD4_T3E VK_F4
    439#define KBD4_T3F VK_F5
    440#define KBD4_T40 VK_F6
    441#define KBD4_T41 VK_F7
    442#define KBD4_T42 VK_F8
    443#define KBD4_T43 VK_F9
    444#define KBD4_T44 VK_F10
    445#define KBD4_T45 VK_NUMLOCK
    446#define KBD4_T46 VK_SCROLL
    447#define KBD4_T47 VK_NUMPAD7 /* VK_HOME */
    448#define KBD4_T48 VK_NUMPAD8 /* VK_UP */
    449#define KBD4_T49 VK_NUMPAD9 /* VK_PRIOR */
    450#define KBD4_T4A VK_SUBTRACT
    451#define KBD4_T4B VK_NUMPAD4 /* VK_LEFT */
    452#define KBD4_T4C VK_NUMPAD5 /* VK_CLEAR */
    453#define KBD4_T4D VK_NUMPAD6 /* VK_RIGHT */
    454#define KBD4_T4E VK_ADD
    455#define KBD4_T4F VK_NUMPAD1 /* VK_END */
    456#define KBD4_T50 VK_NUMPAD2 /* VK_DOWN */
    457#define KBD4_T51 VK_NUMPAD3 /* VK_NEXT */
    458#define KBD4_T52 VK_NUMPAD0 /* VK_INSERT */
    459#define KBD4_T53 VK_DECIMAL /* VK_DELETE */
    460#define KBD4_T54 VK_SNAPSHOT
    461#define KBD4_T55 VK_NONE
    462#define KBD4_T56 VK_OEM_102 /* NE */
    463#define KBD4_T57 VK_F11     /* NE */
    464#define KBD4_T58 VK_F12     /* NE */
    465#define KBD4_T59 VK_CLEAR
    466#define KBD4_T5A VK_OEM_WSCTRL
    467#define KBD4_T5B VK_OEM_FINISH
    468#define KBD4_T5C VK_OEM_JUMP
    469#define KBD4_T5D VK_EREOF
    470#define KBD4_T5E VK_OEM_BACKTAB
    471#define KBD4_T5F VK_OEM_AUTO
    472#define KBD4_T60 VK_NONE
    473#define KBD4_T61 VK_NONE
    474#define KBD4_T62 VK_ZOOM
    475#define KBD4_T63 VK_HELP
    476#define KBD4_T64 VK_F13
    477#define KBD4_T65 VK_F14
    478#define KBD4_T66 VK_F15
    479#define KBD4_T67 VK_F16
    480#define KBD4_T68 VK_F17
    481#define KBD4_T69 VK_F18
    482#define KBD4_T6A VK_F19
    483#define KBD4_T6B VK_F20
    484#define KBD4_T6C VK_F21
    485#define KBD4_T6D VK_F22
    486#define KBD4_T6E VK_F23
    487#define KBD4_T6F VK_OEM_PA3
    488#define KBD4_T70 VK_NONE
    489#define KBD4_T71 VK_OEM_RESET
    490#define KBD4_T72 VK_NONE
    491#define KBD4_T73 VK_ABNT_C1
    492#define KBD4_T74 VK_NONE
    493#define KBD4_T75 VK_NONE
    494#define KBD4_T76 VK_F24
    495#define KBD4_T77 VK_NONE
    496#define KBD4_T78 VK_NONE
    497#define KBD4_T79 VK_NONE
    498#define KBD4_T7A VK_NONE
    499#define KBD4_T7B VK_OEM_PA1
    500#define KBD4_T7C VK_TAB
    501#define KBD4_T7D VK_NONE
    502#define KBD4_T7E VK_ABNT_C2
    503#define KBD4_T7F VK_OEM_PA2
    504
    505#define KBD4_X10 VK_MEDIA_PREV_TRACK
    506#define KBD4_X19 VK_MEDIA_NEXT_TRACK
    507#define KBD4_X1C VK_RETURN
    508#define KBD4_X1D VK_RCONTROL
    509#define KBD4_X20 VK_VOLUME_MUTE
    510#define KBD4_X21 VK_LAUNCH_APP2
    511#define KBD4_X22 VK_MEDIA_PLAY_PAUSE
    512#define KBD4_X24 VK_MEDIA_STOP
    513#define KBD4_X2E VK_VOLUME_DOWN
    514#define KBD4_X30 VK_VOLUME_UP
    515#define KBD4_X32 VK_BROWSER_HOME
    516#define KBD4_X35 VK_DIVIDE
    517#define KBD4_X37 VK_SNAPSHOT
    518#define KBD4_X38 VK_RMENU
    519#define KBD4_X46 VK_PAUSE /* VK_CANCEL */
    520#define KBD4_X47 VK_HOME
    521#define KBD4_X48 VK_UP
    522#define KBD4_X49 VK_PRIOR
    523#define KBD4_X4B VK_LEFT
    524#define KBD4_X4D VK_RIGHT
    525#define KBD4_X4F VK_END
    526#define KBD4_X50 VK_DOWN
    527#define KBD4_X51 VK_NEXT /* NE */
    528#define KBD4_X52 VK_INSERT
    529#define KBD4_X53 VK_DELETE
    530#define KBD4_X5B VK_LWIN
    531#define KBD4_X5C VK_RWIN
    532#define KBD4_X5D VK_APPS
    533#define KBD4_X5E VK_POWER
    534#define KBD4_X5F VK_SLEEP
    535#define KBD4_X65 VK_BROWSER_SEARCH
    536#define KBD4_X66 VK_BROWSER_FAVORITES
    537#define KBD4_X67 VK_BROWSER_REFRESH
    538#define KBD4_X68 VK_BROWSER_STOP
    539#define KBD4_X69 VK_BROWSER_FORWARD
    540#define KBD4_X6A VK_BROWSER_BACK
    541#define KBD4_X6B VK_LAUNCH_APP1
    542#define KBD4_X6C VK_LAUNCH_MAIL
    543#define KBD4_X6D VK_LAUNCH_MEDIA_SELECT
    544
    545#define KBD4_Y1D VK_PAUSE
    546
    547/**
    548 * Keyboard Type 7
    549 */
    550
    551#define KBD7_T00 VK_NONE
    552#define KBD7_T01 VK_ESCAPE
    553#define KBD7_T02 VK_KEY_1
    554#define KBD7_T03 VK_KEY_2
    555#define KBD7_T04 VK_KEY_3
    556#define KBD7_T05 VK_KEY_4
    557#define KBD7_T06 VK_KEY_5
    558#define KBD7_T07 VK_KEY_6
    559#define KBD7_T08 VK_KEY_7
    560#define KBD7_T09 VK_KEY_8
    561#define KBD7_T0A VK_KEY_9
    562#define KBD7_T0B VK_KEY_0
    563#define KBD7_T0C VK_OEM_MINUS
    564#define KBD7_T0D VK_OEM_PLUS
    565#define KBD7_T0E VK_BACK
    566#define KBD7_T0F VK_TAB
    567#define KBD7_T10 VK_KEY_Q
    568#define KBD7_T11 VK_KEY_W
    569#define KBD7_T12 VK_KEY_E
    570#define KBD7_T13 VK_KEY_R
    571#define KBD7_T14 VK_KEY_T
    572#define KBD7_T15 VK_KEY_Y
    573#define KBD7_T16 VK_KEY_U
    574#define KBD7_T17 VK_KEY_I
    575#define KBD7_T18 VK_KEY_O
    576#define KBD7_T19 VK_KEY_P
    577#define KBD7_T1A VK_OEM_4 /* NE */
    578#define KBD7_T1B VK_OEM_6 /* NE */
    579#define KBD7_T1C VK_RETURN
    580#define KBD7_T1D VK_LCONTROL
    581#define KBD7_T1E VK_KEY_A
    582#define KBD7_T1F VK_KEY_S
    583#define KBD7_T20 VK_KEY_D
    584#define KBD7_T21 VK_KEY_F
    585#define KBD7_T22 VK_KEY_G
    586#define KBD7_T23 VK_KEY_H
    587#define KBD7_T24 VK_KEY_J
    588#define KBD7_T25 VK_KEY_K
    589#define KBD7_T26 VK_KEY_L
    590#define KBD7_T27 VK_OEM_1
    591#define KBD7_T28 VK_OEM_7
    592#define KBD7_T29 VK_OEM_3 /* NE */
    593#define KBD7_T2A VK_LSHIFT
    594#define KBD7_T2B VK_OEM_5 /* NE */
    595#define KBD7_T2C VK_KEY_Z
    596#define KBD7_T2D VK_KEY_X
    597#define KBD7_T2E VK_KEY_C
    598#define KBD7_T2F VK_KEY_V
    599#define KBD7_T30 VK_KEY_B
    600#define KBD7_T31 VK_KEY_N
    601#define KBD7_T32 VK_KEY_M
    602#define KBD7_T33 VK_OEM_COMMA
    603#define KBD7_T34 VK_OEM_PERIOD
    604#define KBD7_T35 VK_OEM_2
    605#define KBD7_T36 VK_RSHIFT
    606#define KBD7_T37 VK_MULTIPLY
    607#define KBD7_T38 VK_LMENU
    608#define KBD7_T39 VK_SPACE
    609#define KBD7_T3A VK_CAPITAL
    610#define KBD7_T3B VK_F1
    611#define KBD7_T3C VK_F2
    612#define KBD7_T3D VK_F3
    613#define KBD7_T3E VK_F4
    614#define KBD7_T3F VK_F5
    615#define KBD7_T40 VK_F6
    616#define KBD7_T41 VK_F7
    617#define KBD7_T42 VK_F8
    618#define KBD7_T43 VK_F9
    619#define KBD7_T44 VK_F10
    620#define KBD7_T45 VK_NUMLOCK
    621#define KBD7_T46 VK_SCROLL
    622#define KBD7_T47 VK_NUMPAD7 /* VK_HOME */
    623#define KBD7_T48 VK_NUMPAD8 /* VK_UP */
    624#define KBD7_T49 VK_NUMPAD9 /* VK_PRIOR */
    625#define KBD7_T4A VK_SUBTRACT
    626#define KBD7_T4B VK_NUMPAD4 /* VK_LEFT */
    627#define KBD7_T4C VK_NUMPAD5 /* VK_CLEAR */
    628#define KBD7_T4D VK_NUMPAD6 /* VK_RIGHT */
    629#define KBD7_T4E VK_ADD
    630#define KBD7_T4F VK_NUMPAD1 /* VK_END */
    631#define KBD7_T50 VK_NUMPAD2 /* VK_DOWN */
    632#define KBD7_T51 VK_NUMPAD3 /* VK_NEXT */
    633#define KBD7_T52 VK_NUMPAD0 /* VK_INSERT */
    634#define KBD7_T53 VK_DECIMAL /* VK_DELETE */
    635#define KBD7_T54 VK_SNAPSHOT
    636#define KBD7_T55 VK_NONE
    637#define KBD7_T56 VK_OEM_102
    638#define KBD7_T57 VK_F11
    639#define KBD7_T58 VK_F12
    640#define KBD7_T59 VK_CLEAR
    641#define KBD7_T5A VK_NONAME /* NE */
    642#define KBD7_T5B VK_NONAME /* NE */
    643#define KBD7_T5C VK_NONAME /* NE */
    644#define KBD7_T5D VK_EREOF
    645#define KBD7_T5E VK_NONE   /* NE */
    646#define KBD7_T5F VK_NONAME /* NE */
    647#define KBD7_T60 VK_NONE
    648#define KBD7_T61 VK_NONE /* NE */
    649#define KBD7_T62 VK_NONE /* NE */
    650#define KBD7_T63 VK_NONE
    651#define KBD7_T64 VK_F13
    652#define KBD7_T65 VK_F14
    653#define KBD7_T66 VK_F15
    654#define KBD7_T67 VK_F16
    655#define KBD7_T68 VK_F17
    656#define KBD7_T69 VK_F18
    657#define KBD7_T6A VK_F19
    658#define KBD7_T6B VK_F20
    659#define KBD7_T6C VK_F21
    660#define KBD7_T6D VK_F22
    661#define KBD7_T6E VK_F23
    662#define KBD7_T6F VK_NONE /* NE */
    663#define KBD7_T70 VK_HKTG /* NE */
    664#define KBD7_T71 VK_NONE /* NE */
    665#define KBD7_T72 VK_NONE
    666#define KBD7_T73 VK_ABNT_C1
    667#define KBD7_T74 VK_NONE
    668#define KBD7_T75 VK_NONE
    669#define KBD7_T76 VK_F24
    670#define KBD7_T77 VK_NONE
    671#define KBD7_T78 VK_NONE
    672#define KBD7_T79 VK_CONVERT /* NE */
    673#define KBD7_T7A VK_NONE
    674#define KBD7_T7B VK_NONCONVERT /* NE */
    675#define KBD7_T7C VK_TAB
    676#define KBD7_T7D VK_OEM_8
    677#define KBD7_T7E VK_ABNT_C2
    678#define KBD7_T7F VK_OEM_PA2
    679
    680#define KBD7_X10 VK_MEDIA_PREV_TRACK
    681#define KBD7_X19 VK_MEDIA_NEXT_TRACK
    682#define KBD7_X1C VK_RETURN
    683#define KBD7_X1D VK_RCONTROL
    684#define KBD7_X20 VK_VOLUME_MUTE
    685#define KBD7_X21 VK_LAUNCH_APP2
    686#define KBD7_X22 VK_MEDIA_PLAY_PAUSE
    687#define KBD7_X24 VK_MEDIA_STOP
    688#define KBD7_X2E VK_VOLUME_DOWN
    689#define KBD7_X30 VK_VOLUME_UP
    690#define KBD7_X32 VK_BROWSER_HOME
    691#define KBD7_X33 VK_NONE
    692#define KBD7_X35 VK_DIVIDE
    693#define KBD7_X37 VK_SNAPSHOT
    694#define KBD7_X38 VK_RMENU
    695#define KBD7_X42 VK_NONE
    696#define KBD7_X43 VK_NONE
    697#define KBD7_X44 VK_NONE
    698#define KBD7_X46 VK_CANCEL
    699#define KBD7_X47 VK_HOME
    700#define KBD7_X48 VK_UP
    701#define KBD7_X49 VK_PRIOR
    702#define KBD7_X4B VK_LEFT
    703#define KBD7_X4D VK_RIGHT
    704#define KBD7_X4F VK_END
    705#define KBD7_X50 VK_DOWN
    706#define KBD7_X51 VK_NEXT
    707#define KBD7_X52 VK_INSERT
    708#define KBD7_X53 VK_DELETE
    709#define KBD7_X5B VK_LWIN
    710#define KBD7_X5C VK_RWIN
    711#define KBD7_X5D VK_APPS
    712#define KBD7_X5E VK_POWER
    713#define KBD7_X5F VK_SLEEP
    714#define KBD7_X65 VK_BROWSER_SEARCH
    715#define KBD7_X66 VK_BROWSER_FAVORITES
    716#define KBD7_X67 VK_BROWSER_REFRESH
    717#define KBD7_X68 VK_BROWSER_STOP
    718#define KBD7_X69 VK_BROWSER_FORWARD
    719#define KBD7_X6A VK_BROWSER_BACK
    720#define KBD7_X6B VK_LAUNCH_APP1
    721#define KBD7_X6C VK_LAUNCH_MAIL
    722#define KBD7_X6D VK_LAUNCH_MEDIA_SELECT
    723#define KBD7_XF1 VK_NONE /* NE */
    724#define KBD7_XF2 VK_NONE /* NE */
    725
    726#define KBD7_Y1D VK_PAUSE
    727
    728/**
    729 * X11 Keycodes
    730 */
    731
    732/**
    733 * Mac OS X
    734 */
    735
    736#define APPLE_VK_ANSI_A 0x00
    737#define APPLE_VK_ANSI_S 0x01
    738#define APPLE_VK_ANSI_D 0x02
    739#define APPLE_VK_ANSI_F 0x03
    740#define APPLE_VK_ANSI_H 0x04
    741#define APPLE_VK_ANSI_G 0x05
    742#define APPLE_VK_ANSI_Z 0x06
    743#define APPLE_VK_ANSI_X 0x07
    744#define APPLE_VK_ANSI_C 0x08
    745#define APPLE_VK_ANSI_V 0x09
    746#define APPLE_VK_ISO_Section 0x0A
    747#define APPLE_VK_ANSI_B 0x0B
    748#define APPLE_VK_ANSI_Q 0x0C
    749#define APPLE_VK_ANSI_W 0x0D
    750#define APPLE_VK_ANSI_E 0x0E
    751#define APPLE_VK_ANSI_R 0x0F
    752#define APPLE_VK_ANSI_Y 0x10
    753#define APPLE_VK_ANSI_T 0x11
    754#define APPLE_VK_ANSI_1 0x12
    755#define APPLE_VK_ANSI_2 0x13
    756#define APPLE_VK_ANSI_3 0x14
    757#define APPLE_VK_ANSI_4 0x15
    758#define APPLE_VK_ANSI_6 0x16
    759#define APPLE_VK_ANSI_5 0x17
    760#define APPLE_VK_ANSI_Equal 0x18
    761#define APPLE_VK_ANSI_9 0x19
    762#define APPLE_VK_ANSI_7 0x1A
    763#define APPLE_VK_ANSI_Minus 0x1B
    764#define APPLE_VK_ANSI_8 0x1C
    765#define APPLE_VK_ANSI_0 0x1D
    766#define APPLE_VK_ANSI_RightBracket 0x1E
    767#define APPLE_VK_ANSI_O 0x1F
    768#define APPLE_VK_ANSI_U 0x20
    769#define APPLE_VK_ANSI_LeftBracket 0x21
    770#define APPLE_VK_ANSI_I 0x22
    771#define APPLE_VK_ANSI_P 0x23
    772#define APPLE_VK_Return 0x24
    773#define APPLE_VK_ANSI_L 0x25
    774#define APPLE_VK_ANSI_J 0x26
    775#define APPLE_VK_ANSI_Quote 0x27
    776#define APPLE_VK_ANSI_K 0x28
    777#define APPLE_VK_ANSI_Semicolon 0x29
    778#define APPLE_VK_ANSI_Backslash 0x2A
    779#define APPLE_VK_ANSI_Comma 0x2B
    780#define APPLE_VK_ANSI_Slash 0x2C
    781#define APPLE_VK_ANSI_N 0x2D
    782#define APPLE_VK_ANSI_M 0x2E
    783#define APPLE_VK_ANSI_Period 0x2F
    784#define APPLE_VK_Tab 0x30
    785#define APPLE_VK_Space 0x31
    786#define APPLE_VK_ANSI_Grave 0x32
    787#define APPLE_VK_Delete 0x33
    788#define APPLE_VK_0x34 0x34
    789#define APPLE_VK_Escape 0x35
    790#define APPLE_VK_0x36 0x36
    791#define APPLE_VK_Command 0x37
    792#define APPLE_VK_Shift 0x38
    793#define APPLE_VK_CapsLock 0x39
    794#define APPLE_VK_Option 0x3A
    795#define APPLE_VK_Control 0x3B
    796#define APPLE_VK_RightShift 0x3C
    797#define APPLE_VK_RightOption 0x3D
    798#define APPLE_VK_RightControl 0x3E
    799#define APPLE_VK_Function 0x3F
    800#define APPLE_VK_F17 0x40
    801#define APPLE_VK_ANSI_KeypadDecimal 0x41
    802#define APPLE_VK_0x42 0x42
    803#define APPLE_VK_ANSI_KeypadMultiply 0x43
    804#define APPLE_VK_0x44 0x44
    805#define APPLE_VK_ANSI_KeypadPlus 0x45
    806#define APPLE_VK_0x46 0x46
    807#define APPLE_VK_ANSI_KeypadClear 0x47
    808#define APPLE_VK_VolumeUp 0x48
    809#define APPLE_VK_VolumeDown 0x49
    810#define APPLE_VK_Mute 0x4A
    811#define APPLE_VK_ANSI_KeypadDivide 0x4B
    812#define APPLE_VK_ANSI_KeypadEnter 0x4C
    813#define APPLE_VK_0x4D 0x4D
    814#define APPLE_VK_ANSI_KeypadMinus 0x4E
    815#define APPLE_VK_F18 0x4F
    816#define APPLE_VK_F19 0x50
    817#define APPLE_VK_ANSI_KeypadEquals 0x51
    818#define APPLE_VK_ANSI_Keypad0 0x52
    819#define APPLE_VK_ANSI_Keypad1 0x53
    820#define APPLE_VK_ANSI_Keypad2 0x54
    821#define APPLE_VK_ANSI_Keypad3 0x55
    822#define APPLE_VK_ANSI_Keypad4 0x56
    823#define APPLE_VK_ANSI_Keypad5 0x57
    824#define APPLE_VK_ANSI_Keypad6 0x58
    825#define APPLE_VK_ANSI_Keypad7 0x59
    826#define APPLE_VK_F20 0x5A
    827#define APPLE_VK_ANSI_Keypad8 0x5B
    828#define APPLE_VK_ANSI_Keypad9 0x5C
    829#define APPLE_VK_JIS_Yen 0x5D
    830#define APPLE_VK_JIS_Underscore 0x5E
    831#define APPLE_VK_JIS_KeypadComma 0x5F
    832#define APPLE_VK_F5 0x60
    833#define APPLE_VK_F6 0x61
    834#define APPLE_VK_F7 0x62
    835#define APPLE_VK_F3 0x63
    836#define APPLE_VK_F8 0x64
    837#define APPLE_VK_F9 0x65
    838#define APPLE_VK_JIS_Eisu 0x66
    839#define APPLE_VK_F11 0x67
    840#define APPLE_VK_JIS_Kana 0x68
    841#define APPLE_VK_F13 0x69
    842#define APPLE_VK_F16 0x6A
    843#define APPLE_VK_F14 0x6B
    844#define APPLE_VK_F10 0x6D
    845#define APPLE_VK_0x6C 0x6C
    846#define APPLE_VK_0x6E 0x6E
    847#define APPLE_VK_F12 0x6F
    848#define APPLE_VK_0x70 0x70
    849#define APPLE_VK_F15 0x71
    850#define APPLE_VK_Help 0x72
    851#define APPLE_VK_Home 0x73
    852#define APPLE_VK_PageUp 0x74
    853#define APPLE_VK_ForwardDelete 0x75
    854#define APPLE_VK_F4 0x76
    855#define APPLE_VK_End 0x77
    856#define APPLE_VK_F2 0x78
    857#define APPLE_VK_PageDown 0x79
    858#define APPLE_VK_F1 0x7A
    859#define APPLE_VK_LeftArrow 0x7B
    860#define APPLE_VK_RightArrow 0x7C
    861#define APPLE_VK_DownArrow 0x7D
    862#define APPLE_VK_UpArrow 0x7E
    863
    864#ifdef __cplusplus
    865extern "C"
    866{
    867#endif
    868
    869	/**
    870	 * Functions
    871	 */
    872
    873	WINPR_API char* GetVirtualKeyName(DWORD vkcode);
    874	WINPR_API DWORD GetVirtualKeyCodeFromName(const char* vkname);
    875	WINPR_API DWORD GetVirtualKeyCodeFromXkbKeyName(const char* xkbname);
    876
    877	WINPR_API DWORD GetVirtualKeyCodeFromVirtualScanCode(DWORD scancode, DWORD dwKeyboardType);
    878	WINPR_API DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeyboardType);
    879
    880#define KEYCODE_TYPE_APPLE 0x00000001
    881#define KEYCODE_TYPE_EVDEV 0x00000002
    882
    883	WINPR_API DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags);
    884	WINPR_API DWORD GetKeycodeFromVirtualKeyCode(DWORD keycode, DWORD dwFlags);
    885
    886#ifdef __cplusplus
    887}
    888#endif
    889
    890#endif /* WINPR_INPUT_H */