Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | // keymap.h - this file is shared between SInput.cxx and CKeyboard.cxx |
| 20 | // |
| 21 | // Mapping of X keysyms to and from Windows VK codes. Ordering here must be |
| 22 | // such that when we look up a Windows VK code we get the preferred X keysym. |
| 23 | // Going the other way there is no problem because an X keysym always maps to |
| 24 | // exactly one Windows VK code. This map only contain keys which are not the |
| 25 | // normal keys for printable ASCII characters. For example it does not contain |
| 26 | // VK_SPACE (note that things like VK_ADD are for the plus key on the keypad, |
| 27 | // not on the main keyboard). |
| 28 | |
| 29 | struct keymap_t { |
| 30 | rdr::U32 keysym; |
| 31 | rdr::U8 vk; |
| 32 | bool extended; |
| 33 | }; |
| 34 | |
| 35 | static keymap_t keymap[] = { |
| 36 | |
| 37 | { XK_BackSpace, VK_BACK, 0 }, |
| 38 | { XK_Tab, VK_TAB, 0 }, |
| 39 | { XK_Clear, VK_CLEAR, 0 }, |
| 40 | { XK_Return, VK_RETURN, 0 }, |
| 41 | { XK_Pause, VK_PAUSE, 0 }, |
| 42 | { XK_Escape, VK_ESCAPE, 0 }, |
| 43 | { XK_Delete, VK_DELETE, 1 }, |
| 44 | |
| 45 | // Cursor control & motion |
| 46 | |
| 47 | { XK_Home, VK_HOME, 1 }, |
| 48 | { XK_Left, VK_LEFT, 1 }, |
| 49 | { XK_Up, VK_UP, 1 }, |
| 50 | { XK_Right, VK_RIGHT, 1 }, |
| 51 | { XK_Down, VK_DOWN, 1 }, |
| 52 | { XK_Page_Up, VK_PRIOR, 1 }, |
| 53 | { XK_Page_Down, VK_NEXT, 1 }, |
| 54 | { XK_End, VK_END, 1 }, |
| 55 | |
| 56 | // Misc functions |
| 57 | |
| 58 | { XK_Select, VK_SELECT, 0 }, |
| 59 | { XK_Print, VK_SNAPSHOT, 0 }, |
| 60 | { XK_Execute, VK_EXECUTE, 0 }, |
| 61 | { XK_Insert, VK_INSERT, 1 }, |
| 62 | { XK_Help, VK_HELP, 0 }, |
| 63 | { XK_Break, VK_CANCEL, 1 }, |
| 64 | |
| 65 | // Auxilliary Functions - must come before XK_KP_F1, etc |
| 66 | |
| 67 | { XK_F1, VK_F1, 0 }, |
| 68 | { XK_F2, VK_F2, 0 }, |
| 69 | { XK_F3, VK_F3, 0 }, |
| 70 | { XK_F4, VK_F4, 0 }, |
| 71 | { XK_F5, VK_F5, 0 }, |
| 72 | { XK_F6, VK_F6, 0 }, |
| 73 | { XK_F7, VK_F7, 0 }, |
| 74 | { XK_F8, VK_F8, 0 }, |
| 75 | { XK_F9, VK_F9, 0 }, |
| 76 | { XK_F10, VK_F10, 0 }, |
| 77 | { XK_F11, VK_F11, 0 }, |
| 78 | { XK_F12, VK_F12, 0 }, |
| 79 | { XK_F13, VK_F13, 0 }, |
| 80 | { XK_F14, VK_F14, 0 }, |
| 81 | { XK_F15, VK_F15, 0 }, |
| 82 | { XK_F16, VK_F16, 0 }, |
| 83 | { XK_F17, VK_F17, 0 }, |
| 84 | { XK_F18, VK_F18, 0 }, |
| 85 | { XK_F19, VK_F19, 0 }, |
| 86 | { XK_F20, VK_F20, 0 }, |
| 87 | { XK_F21, VK_F21, 0 }, |
| 88 | { XK_F22, VK_F22, 0 }, |
| 89 | { XK_F23, VK_F23, 0 }, |
| 90 | { XK_F24, VK_F24, 0 }, |
| 91 | |
| 92 | // Keypad Functions, keypad numbers |
| 93 | |
| 94 | { XK_KP_Tab, VK_TAB, 0 }, |
| 95 | { XK_KP_Enter, VK_RETURN, 1 }, |
| 96 | { XK_KP_F1, VK_F1, 0 }, |
| 97 | { XK_KP_F2, VK_F2, 0 }, |
| 98 | { XK_KP_F3, VK_F3, 0 }, |
| 99 | { XK_KP_F4, VK_F4, 0 }, |
| 100 | { XK_KP_Home, VK_HOME, 0 }, |
| 101 | { XK_KP_Left, VK_LEFT, 0 }, |
| 102 | { XK_KP_Up, VK_UP, 0 }, |
| 103 | { XK_KP_Right, VK_RIGHT, 0 }, |
| 104 | { XK_KP_Down, VK_DOWN, 0 }, |
| 105 | { XK_KP_End, VK_END, 0 }, |
| 106 | { XK_KP_Page_Up, VK_PRIOR, 0 }, |
| 107 | { XK_KP_Page_Down, VK_NEXT, 0 }, |
| 108 | { XK_KP_Begin, VK_CLEAR, 0 }, |
| 109 | { XK_KP_Insert, VK_INSERT, 0 }, |
| 110 | { XK_KP_Delete, VK_DELETE, 0 }, |
| 111 | { XK_KP_Multiply, VK_MULTIPLY, 0 }, |
| 112 | { XK_KP_Add, VK_ADD, 0 }, |
| 113 | { XK_KP_Separator, VK_SEPARATOR, 0 }, |
| 114 | { XK_KP_Subtract, VK_SUBTRACT, 0 }, |
| 115 | { XK_KP_Decimal, VK_DECIMAL, 0 }, |
| 116 | { XK_KP_Divide, VK_DIVIDE, 1 }, |
| 117 | |
| 118 | { XK_KP_0, VK_NUMPAD0, 0 }, |
| 119 | { XK_KP_1, VK_NUMPAD1, 0 }, |
| 120 | { XK_KP_2, VK_NUMPAD2, 0 }, |
| 121 | { XK_KP_3, VK_NUMPAD3, 0 }, |
| 122 | { XK_KP_4, VK_NUMPAD4, 0 }, |
| 123 | { XK_KP_5, VK_NUMPAD5, 0 }, |
| 124 | { XK_KP_6, VK_NUMPAD6, 0 }, |
| 125 | { XK_KP_7, VK_NUMPAD7, 0 }, |
| 126 | { XK_KP_8, VK_NUMPAD8, 0 }, |
| 127 | { XK_KP_9, VK_NUMPAD9, 0 }, |
| 128 | |
| 129 | // Modifiers |
| 130 | |
| 131 | { XK_Shift_L, VK_SHIFT, 0 }, |
| 132 | { XK_Shift_R, VK_SHIFT, 0 }, |
| 133 | { XK_Control_L, VK_CONTROL, 0 }, |
| 134 | { XK_Control_R, VK_CONTROL, 1 }, |
| 135 | { XK_Alt_L, VK_MENU, 0 }, |
| 136 | { XK_Alt_R, VK_MENU, 1 }, |
| 137 | |
| 138 | // Left & Right Windows keys & Windows Menu Key |
| 139 | |
| 140 | { XK_Super_L, VK_LWIN, 0 }, |
| 141 | { XK_Super_R, VK_RWIN, 0 }, |
| 142 | { XK_Menu, VK_APPS, 0 }, |
| 143 | |
| 144 | // Japanese stuff - almost certainly wrong... |
| 145 | |
| 146 | { XK_Kanji, VK_KANJI, 0 }, |
| 147 | { XK_Kana_Shift, VK_KANA, 0 }, |
| 148 | |
| 149 | }; |