You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

keymap.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. // keymap.h - this file is shared between SInput.cxx and CKeyboard.cxx
  19. //
  20. // Mapping of X keysyms to and from Windows VK codes. Ordering here must be
  21. // such that when we look up a Windows VK code we get the preferred X keysym.
  22. // Going the other way there is no problem because an X keysym always maps to
  23. // exactly one Windows VK code. This map only contain keys which are not the
  24. // normal keys for printable ASCII characters. For example it does not contain
  25. // VK_SPACE (note that things like VK_ADD are for the plus key on the keypad,
  26. // not on the main keyboard).
  27. struct keymap_t {
  28. rdr::U32 keysym;
  29. rdr::U8 vk;
  30. bool extended;
  31. };
  32. static keymap_t keymap[] = {
  33. { XK_BackSpace, VK_BACK, 0 },
  34. { XK_Tab, VK_TAB, 0 },
  35. { XK_Clear, VK_CLEAR, 0 },
  36. { XK_Return, VK_RETURN, 0 },
  37. { XK_Pause, VK_PAUSE, 0 },
  38. { XK_Escape, VK_ESCAPE, 0 },
  39. { XK_Delete, VK_DELETE, 1 },
  40. // Cursor control & motion
  41. { XK_Home, VK_HOME, 1 },
  42. { XK_Left, VK_LEFT, 1 },
  43. { XK_Up, VK_UP, 1 },
  44. { XK_Right, VK_RIGHT, 1 },
  45. { XK_Down, VK_DOWN, 1 },
  46. { XK_Page_Up, VK_PRIOR, 1 },
  47. { XK_Page_Down, VK_NEXT, 1 },
  48. { XK_End, VK_END, 1 },
  49. // Misc functions
  50. { XK_Select, VK_SELECT, 0 },
  51. { XK_Print, VK_SNAPSHOT, 0 },
  52. { XK_Execute, VK_EXECUTE, 0 },
  53. { XK_Insert, VK_INSERT, 1 },
  54. { XK_Help, VK_HELP, 0 },
  55. { XK_Break, VK_CANCEL, 1 },
  56. // Auxiliary Functions - must come before XK_KP_F1, etc
  57. { XK_F1, VK_F1, 0 },
  58. { XK_F2, VK_F2, 0 },
  59. { XK_F3, VK_F3, 0 },
  60. { XK_F4, VK_F4, 0 },
  61. { XK_F5, VK_F5, 0 },
  62. { XK_F6, VK_F6, 0 },
  63. { XK_F7, VK_F7, 0 },
  64. { XK_F8, VK_F8, 0 },
  65. { XK_F9, VK_F9, 0 },
  66. { XK_F10, VK_F10, 0 },
  67. { XK_F11, VK_F11, 0 },
  68. { XK_F12, VK_F12, 0 },
  69. { XK_F13, VK_F13, 0 },
  70. { XK_F14, VK_F14, 0 },
  71. { XK_F15, VK_F15, 0 },
  72. { XK_F16, VK_F16, 0 },
  73. { XK_F17, VK_F17, 0 },
  74. { XK_F18, VK_F18, 0 },
  75. { XK_F19, VK_F19, 0 },
  76. { XK_F20, VK_F20, 0 },
  77. { XK_F21, VK_F21, 0 },
  78. { XK_F22, VK_F22, 0 },
  79. { XK_F23, VK_F23, 0 },
  80. { XK_F24, VK_F24, 0 },
  81. // Keypad Functions, keypad numbers
  82. { XK_KP_Tab, VK_TAB, 0 },
  83. { XK_KP_Enter, VK_RETURN, 1 },
  84. { XK_KP_F1, VK_F1, 0 },
  85. { XK_KP_F2, VK_F2, 0 },
  86. { XK_KP_F3, VK_F3, 0 },
  87. { XK_KP_F4, VK_F4, 0 },
  88. { XK_KP_Home, VK_HOME, 0 },
  89. { XK_KP_Left, VK_LEFT, 0 },
  90. { XK_KP_Up, VK_UP, 0 },
  91. { XK_KP_Right, VK_RIGHT, 0 },
  92. { XK_KP_Down, VK_DOWN, 0 },
  93. { XK_KP_End, VK_END, 0 },
  94. { XK_KP_Page_Up, VK_PRIOR, 0 },
  95. { XK_KP_Page_Down, VK_NEXT, 0 },
  96. { XK_KP_Begin, VK_CLEAR, 0 },
  97. { XK_KP_Insert, VK_INSERT, 0 },
  98. { XK_KP_Delete, VK_DELETE, 0 },
  99. { XK_KP_Multiply, VK_MULTIPLY, 0 },
  100. { XK_KP_Add, VK_ADD, 0 },
  101. { XK_KP_Separator, VK_SEPARATOR, 0 },
  102. { XK_KP_Subtract, VK_SUBTRACT, 0 },
  103. { XK_KP_Decimal, VK_DECIMAL, 0 },
  104. { XK_KP_Divide, VK_DIVIDE, 1 },
  105. { XK_KP_0, VK_NUMPAD0, 0 },
  106. { XK_KP_1, VK_NUMPAD1, 0 },
  107. { XK_KP_2, VK_NUMPAD2, 0 },
  108. { XK_KP_3, VK_NUMPAD3, 0 },
  109. { XK_KP_4, VK_NUMPAD4, 0 },
  110. { XK_KP_5, VK_NUMPAD5, 0 },
  111. { XK_KP_6, VK_NUMPAD6, 0 },
  112. { XK_KP_7, VK_NUMPAD7, 0 },
  113. { XK_KP_8, VK_NUMPAD8, 0 },
  114. { XK_KP_9, VK_NUMPAD9, 0 },
  115. // Modifiers
  116. { XK_Shift_L, VK_SHIFT, 0 },
  117. { XK_Shift_R, VK_SHIFT, 0 },
  118. { XK_Control_L, VK_CONTROL, 0 },
  119. { XK_Control_R, VK_CONTROL, 1 },
  120. { XK_Alt_L, VK_MENU, 0 },
  121. { XK_Alt_R, VK_MENU, 1 },
  122. { XK_Meta_L, VK_MENU, 0 },
  123. { XK_Meta_R, VK_MENU, 1 },
  124. // Left & Right Windows keys & Windows Menu Key
  125. { XK_Super_L, VK_LWIN, 0 },
  126. { XK_Super_R, VK_RWIN, 0 },
  127. { XK_Menu, VK_APPS, 0 },
  128. // Japanese stuff - almost certainly wrong...
  129. { XK_Kanji, VK_KANJI, 0 },
  130. { XK_Kana_Shift, VK_KANA, 0 },
  131. };