curses 1.2.6 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +19 -0
  3. data/.github/workflows/ubuntu.yml +26 -0
  4. data/.github/workflows/windows.yml +28 -0
  5. data/.gitmodules +1 -1
  6. data/.travis.yml +6 -3
  7. data/History.md +40 -0
  8. data/README.md +4 -1
  9. data/Rakefile +0 -83
  10. data/curses.gemspec +2 -3
  11. data/ext/curses/curses.c +1271 -151
  12. data/ext/curses/extconf.rb +140 -17
  13. data/lib/curses.rb +5 -12
  14. data/sample/form.rb +52 -0
  15. data/sample/menu.rb +1 -1
  16. data/vendor/PDCurses/.gitignore +47 -0
  17. data/vendor/PDCurses/.travis.yml +49 -0
  18. data/vendor/PDCurses/CMakeLists.txt +68 -0
  19. data/vendor/PDCurses/HISTORY.md +2036 -0
  20. data/vendor/PDCurses/IMPLEMNT.md +327 -0
  21. data/vendor/PDCurses/README.md +77 -0
  22. data/vendor/PDCurses/acs_defs.h +265 -0
  23. data/vendor/PDCurses/appveyor.yml +218 -0
  24. data/vendor/PDCurses/cmake/README.md +71 -0
  25. data/vendor/PDCurses/cmake/build_dependencies.cmake +178 -0
  26. data/vendor/PDCurses/cmake/build_options.cmake +25 -0
  27. data/vendor/PDCurses/cmake/dll_version.cmake +26 -0
  28. data/vendor/PDCurses/cmake/gen_config_header.cmake +43 -0
  29. data/vendor/PDCurses/cmake/get_version.cmake +17 -0
  30. data/vendor/PDCurses/cmake/make_uninstall.cmake +19 -0
  31. data/vendor/PDCurses/cmake/project_common.cmake +121 -0
  32. data/vendor/PDCurses/cmake/resource.in.cmake +52 -0
  33. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +83 -0
  34. data/vendor/PDCurses/cmake/target_arch.cmake +36 -0
  35. data/vendor/PDCurses/cmake/version.in.cmake +73 -0
  36. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +96 -0
  37. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +106 -0
  38. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +105 -0
  39. data/vendor/PDCurses/curses.h +1846 -0
  40. data/vendor/PDCurses/curspriv.h +134 -0
  41. data/vendor/PDCurses/demos/README.md +25 -0
  42. data/vendor/PDCurses/demos/firework.c +144 -0
  43. data/vendor/PDCurses/demos/newtest.c +581 -0
  44. data/vendor/PDCurses/demos/ozdemo.c +447 -0
  45. data/vendor/PDCurses/demos/ptest.c +283 -0
  46. data/vendor/PDCurses/demos/rain.c +157 -0
  47. data/vendor/PDCurses/demos/testcurs.c +1607 -0
  48. data/vendor/PDCurses/demos/tui.c +1048 -0
  49. data/vendor/PDCurses/demos/tui.h +65 -0
  50. data/vendor/PDCurses/demos/tuidemo.c +233 -0
  51. data/vendor/PDCurses/demos/version.c +61 -0
  52. data/vendor/PDCurses/demos/worm.c +432 -0
  53. data/vendor/PDCurses/demos/xmas.c +955 -0
  54. data/vendor/PDCurses/dos/CMakeLists.txt +47 -0
  55. data/vendor/PDCurses/dos/Makefile.bcc +83 -0
  56. data/vendor/PDCurses/dos/Makefile.dmc +257 -0
  57. data/vendor/PDCurses/dos/Makefile.msc +113 -0
  58. data/vendor/PDCurses/dos/Makefile.wcc +107 -0
  59. data/vendor/PDCurses/dos/README.md +51 -0
  60. data/vendor/PDCurses/dos/bccdos.lrf +9 -0
  61. data/vendor/PDCurses/dos/mscdos.lrf +50 -0
  62. data/vendor/PDCurses/dos/pdcclip.c +132 -0
  63. data/vendor/PDCurses/dos/pdcdisp.c +135 -0
  64. data/vendor/PDCurses/dos/pdcdos.h +194 -0
  65. data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
  66. data/vendor/PDCurses/dos/pdckbd.c +513 -0
  67. data/vendor/PDCurses/dos/pdcscrn.c +785 -0
  68. data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
  69. data/vendor/PDCurses/dos/pdcutil.c +212 -0
  70. data/vendor/PDCurses/libobjs.mif +26 -0
  71. data/vendor/PDCurses/makedist.mif +20 -0
  72. data/vendor/PDCurses/man/README.md +21 -0
  73. data/vendor/PDCurses/man/intro.md +361 -0
  74. data/vendor/PDCurses/man/manext.c +119 -0
  75. data/vendor/PDCurses/man/sdl.md +152 -0
  76. data/vendor/PDCurses/man/sdl2.md +58 -0
  77. data/vendor/PDCurses/man/x11.md +407 -0
  78. data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
  79. data/vendor/PDCurses/ncurses/README.md +26 -0
  80. data/vendor/PDCurses/ncurses/makefile +29 -0
  81. data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
  82. data/vendor/PDCurses/os2/Makefile.bcc +90 -0
  83. data/vendor/PDCurses/os2/Makefile.wcc +43 -0
  84. data/vendor/PDCurses/os2/README.md +43 -0
  85. data/vendor/PDCurses/os2/iccos2.lrf +50 -0
  86. data/vendor/PDCurses/os2/iccos2.mak +256 -0
  87. data/vendor/PDCurses/os2/pdcclip.c +188 -0
  88. data/vendor/PDCurses/os2/pdcdisp.c +93 -0
  89. data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
  90. data/vendor/PDCurses/os2/pdckbd.c +521 -0
  91. data/vendor/PDCurses/os2/pdcos2.h +55 -0
  92. data/vendor/PDCurses/os2/pdcscrn.c +449 -0
  93. data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
  94. data/vendor/PDCurses/os2/pdcutil.c +52 -0
  95. data/vendor/PDCurses/panel.h +56 -0
  96. data/vendor/PDCurses/pdcurses/README.md +25 -0
  97. data/vendor/PDCurses/pdcurses/addch.c +693 -0
  98. data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
  99. data/vendor/PDCurses/pdcurses/addstr.c +240 -0
  100. data/vendor/PDCurses/pdcurses/attr.c +359 -0
  101. data/vendor/PDCurses/pdcurses/beep.c +68 -0
  102. data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
  103. data/vendor/PDCurses/pdcurses/border.c +411 -0
  104. data/vendor/PDCurses/pdcurses/clear.c +159 -0
  105. data/vendor/PDCurses/pdcurses/color.c +298 -0
  106. data/vendor/PDCurses/pdcurses/debug.c +109 -0
  107. data/vendor/PDCurses/pdcurses/delch.c +96 -0
  108. data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
  109. data/vendor/PDCurses/pdcurses/deprec.c +27 -0
  110. data/vendor/PDCurses/pdcurses/getch.c +417 -0
  111. data/vendor/PDCurses/pdcurses/getstr.c +474 -0
  112. data/vendor/PDCurses/pdcurses/getyx.c +139 -0
  113. data/vendor/PDCurses/pdcurses/inch.c +127 -0
  114. data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
  115. data/vendor/PDCurses/pdcurses/initscr.c +367 -0
  116. data/vendor/PDCurses/pdcurses/inopts.c +324 -0
  117. data/vendor/PDCurses/pdcurses/insch.c +271 -0
  118. data/vendor/PDCurses/pdcurses/insstr.c +264 -0
  119. data/vendor/PDCurses/pdcurses/instr.c +246 -0
  120. data/vendor/PDCurses/pdcurses/kernel.c +259 -0
  121. data/vendor/PDCurses/pdcurses/keyname.c +157 -0
  122. data/vendor/PDCurses/pdcurses/mouse.c +438 -0
  123. data/vendor/PDCurses/pdcurses/move.c +57 -0
  124. data/vendor/PDCurses/pdcurses/outopts.c +159 -0
  125. data/vendor/PDCurses/pdcurses/overlay.c +214 -0
  126. data/vendor/PDCurses/pdcurses/pad.c +260 -0
  127. data/vendor/PDCurses/pdcurses/panel.c +633 -0
  128. data/vendor/PDCurses/pdcurses/printw.c +126 -0
  129. data/vendor/PDCurses/pdcurses/refresh.c +279 -0
  130. data/vendor/PDCurses/pdcurses/scanw.c +578 -0
  131. data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
  132. data/vendor/PDCurses/pdcurses/scroll.c +101 -0
  133. data/vendor/PDCurses/pdcurses/slk.c +591 -0
  134. data/vendor/PDCurses/pdcurses/termattr.c +182 -0
  135. data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
  136. data/vendor/PDCurses/pdcurses/touch.c +163 -0
  137. data/vendor/PDCurses/pdcurses/util.c +312 -0
  138. data/vendor/PDCurses/pdcurses/window.c +569 -0
  139. data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
  140. data/vendor/PDCurses/sdl1/README.md +31 -0
  141. data/vendor/PDCurses/sdl1/deffont.h +385 -0
  142. data/vendor/PDCurses/sdl1/deficon.h +23 -0
  143. data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
  144. data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
  145. data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
  146. data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
  147. data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
  148. data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
  149. data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
  150. data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
  151. data/vendor/PDCurses/sdl1/sdltest.c +79 -0
  152. data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
  153. data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
  154. data/vendor/PDCurses/sdl2/README.md +34 -0
  155. data/vendor/PDCurses/sdl2/deffont.h +385 -0
  156. data/vendor/PDCurses/sdl2/deficon.h +23 -0
  157. data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
  158. data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
  159. data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
  160. data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
  161. data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
  162. data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
  163. data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
  164. data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
  165. data/vendor/PDCurses/sdl2/sdltest.c +81 -0
  166. data/vendor/PDCurses/term.h +48 -0
  167. data/vendor/PDCurses/version.mif +7 -0
  168. data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
  169. data/vendor/PDCurses/vt/Makefile.bcc +111 -0
  170. data/vendor/PDCurses/vt/Makefile.dmc +258 -0
  171. data/vendor/PDCurses/vt/Makefile.vc +144 -0
  172. data/vendor/PDCurses/vt/Makefile.wcc +107 -0
  173. data/vendor/PDCurses/vt/README.md +64 -0
  174. data/vendor/PDCurses/vt/pdcclip.c +20 -0
  175. data/vendor/PDCurses/vt/pdcdisp.c +284 -0
  176. data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
  177. data/vendor/PDCurses/vt/pdckbd.c +394 -0
  178. data/vendor/PDCurses/vt/pdcscrn.c +434 -0
  179. data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
  180. data/vendor/PDCurses/vt/pdcutil.c +43 -0
  181. data/vendor/PDCurses/vt/pdcvt.h +16 -0
  182. data/vendor/PDCurses/watcom.mif +68 -0
  183. data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
  184. data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
  185. data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
  186. data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
  187. data/vendor/PDCurses/wincon/Makefile.mng +176 -0
  188. data/vendor/PDCurses/wincon/Makefile.vc +144 -0
  189. data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
  190. data/vendor/PDCurses/wincon/README.md +85 -0
  191. data/vendor/PDCurses/wincon/pdcclip.c +174 -0
  192. data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
  193. data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
  194. data/vendor/PDCurses/wincon/pdckbd.c +786 -0
  195. data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
  196. data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
  197. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  198. data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
  199. data/vendor/PDCurses/wincon/pdcutil.c +41 -0
  200. data/vendor/PDCurses/wincon/pdcwin.h +31 -0
  201. data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
  202. data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
  203. data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
  204. data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
  205. data/vendor/PDCurses/wingui/Makefile.mng +171 -0
  206. data/vendor/PDCurses/wingui/Makefile.vc +144 -0
  207. data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
  208. data/vendor/PDCurses/wingui/README.md +93 -0
  209. data/vendor/PDCurses/wingui/pdcclip.c +174 -0
  210. data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
  211. data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
  212. data/vendor/PDCurses/wingui/pdckbd.c +143 -0
  213. data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
  214. data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
  215. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  216. data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
  217. data/vendor/PDCurses/wingui/pdcutil.c +61 -0
  218. data/vendor/PDCurses/wingui/pdcwin.h +122 -0
  219. data/vendor/PDCurses/x11/Makefile.in +754 -0
  220. data/vendor/PDCurses/x11/PDCurses.spec +82 -0
  221. data/vendor/PDCurses/x11/README.md +62 -0
  222. data/vendor/PDCurses/x11/ScrollBox.c +319 -0
  223. data/vendor/PDCurses/x11/ScrollBox.h +51 -0
  224. data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
  225. data/vendor/PDCurses/x11/aclocal.m4 +994 -0
  226. data/vendor/PDCurses/x11/big_icon.xbm +46 -0
  227. data/vendor/PDCurses/x11/compose.h +201 -0
  228. data/vendor/PDCurses/x11/config.guess +1500 -0
  229. data/vendor/PDCurses/x11/config.h.in +100 -0
  230. data/vendor/PDCurses/x11/config.sub +1616 -0
  231. data/vendor/PDCurses/x11/configure +6700 -0
  232. data/vendor/PDCurses/x11/configure.ac +295 -0
  233. data/vendor/PDCurses/x11/debian/changelog +6 -0
  234. data/vendor/PDCurses/x11/debian/compat +1 -0
  235. data/vendor/PDCurses/x11/debian/control +11 -0
  236. data/vendor/PDCurses/x11/debian/copyright +27 -0
  237. data/vendor/PDCurses/x11/debian/rules +98 -0
  238. data/vendor/PDCurses/x11/install-sh +253 -0
  239. data/vendor/PDCurses/x11/little_icon.xbm +14 -0
  240. data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
  241. data/vendor/PDCurses/x11/pdcclip.c +173 -0
  242. data/vendor/PDCurses/x11/pdcdisp.c +85 -0
  243. data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
  244. data/vendor/PDCurses/x11/pdckbd.c +104 -0
  245. data/vendor/PDCurses/x11/pdcscrn.c +258 -0
  246. data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
  247. data/vendor/PDCurses/x11/pdcutil.c +52 -0
  248. data/vendor/PDCurses/x11/pdcx11.c +316 -0
  249. data/vendor/PDCurses/x11/pdcx11.h +191 -0
  250. data/vendor/PDCurses/x11/sb.c +155 -0
  251. data/vendor/PDCurses/x11/x11.c +3686 -0
  252. data/vendor/PDCurses/x11/xcurses-config.in +81 -0
  253. metadata +255 -21
@@ -0,0 +1,55 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include "pdcwin.h"
4
+
5
+ /* get the cursor size/shape */
6
+
7
+ int PDC_get_cursor_mode(void)
8
+ {
9
+ CONSOLE_CURSOR_INFO ci;
10
+
11
+ PDC_LOG(("PDC_get_cursor_mode() - called\n"));
12
+
13
+ GetConsoleCursorInfo(pdc_con_out, &ci);
14
+
15
+ return ci.dwSize;
16
+ }
17
+
18
+ /* return number of screen rows */
19
+
20
+ int PDC_get_rows(void)
21
+ {
22
+ CONSOLE_SCREEN_BUFFER_INFO scr;
23
+
24
+ PDC_LOG(("PDC_get_rows() - called\n"));
25
+
26
+ GetConsoleScreenBufferInfo(pdc_con_out, &scr);
27
+
28
+ return scr.srWindow.Bottom - scr.srWindow.Top + 1;
29
+ }
30
+
31
+ /* return number of buffer rows */
32
+
33
+ int PDC_get_buffer_rows(void)
34
+ {
35
+ CONSOLE_SCREEN_BUFFER_INFO scr;
36
+
37
+ PDC_LOG(("PDC_get_buffer_rows() - called\n"));
38
+
39
+ GetConsoleScreenBufferInfo(pdc_con_out, &scr);
40
+
41
+ return scr.dwSize.Y;
42
+ }
43
+
44
+ /* return width of screen/viewport */
45
+
46
+ int PDC_get_columns(void)
47
+ {
48
+ CONSOLE_SCREEN_BUFFER_INFO scr;
49
+
50
+ PDC_LOG(("PDC_get_columns() - called\n"));
51
+
52
+ GetConsoleScreenBufferInfo(pdc_con_out, &scr);
53
+
54
+ return scr.srWindow.Right - scr.srWindow.Left + 1;
55
+ }
@@ -0,0 +1,786 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include "pdcwin.h"
4
+
5
+ /*man-start**************************************************************
6
+
7
+ pdckbd
8
+ ------
9
+
10
+ ### Synopsis
11
+
12
+ unsigned long PDC_get_input_fd(void);
13
+
14
+ ### Description
15
+
16
+ PDC_get_input_fd() returns the file descriptor that PDCurses
17
+ reads its input from. It can be used for select().
18
+
19
+ ### Portability
20
+ X/Open BSD SYS V
21
+ PDC_get_input_fd - - -
22
+
23
+ **man-end****************************************************************/
24
+
25
+ unsigned long pdc_key_modifiers = 0L;
26
+
27
+ /* These variables are used to store information about the next
28
+ Input Event. */
29
+
30
+ static INPUT_RECORD save_ip;
31
+ static MOUSE_STATUS old_mouse_status;
32
+ static DWORD event_count = 0;
33
+ static SHORT left_key;
34
+ static int key_count = 0;
35
+ static int save_press = 0;
36
+
37
+ #define KEV save_ip.Event.KeyEvent
38
+ #define MEV save_ip.Event.MouseEvent
39
+ #define REV save_ip.Event.WindowBufferSizeEvent
40
+
41
+ /************************************************************************
42
+ * Table for key code translation of function keys in keypad mode *
43
+ * These values are for strict IBM keyboard compatibles only *
44
+ ************************************************************************/
45
+
46
+ typedef struct
47
+ {
48
+ unsigned short normal;
49
+ unsigned short shift;
50
+ unsigned short control;
51
+ unsigned short alt;
52
+ unsigned short extended;
53
+ } KPTAB;
54
+
55
+ static KPTAB kptab[] =
56
+ {
57
+ {0, 0, 0, 0, 0 }, /* 0 */
58
+ {0, 0, 0, 0, 0 }, /* 1 VK_LBUTTON */
59
+ {0, 0, 0, 0, 0 }, /* 2 VK_RBUTTON */
60
+ {CTL_PAUSE, 0, 0, 0, 0 }, /* 3 VK_CANCEL */
61
+ {0, 0, 0, 0, 0 }, /* 4 VK_MBUTTON */
62
+ {0, 0, 0, 0, 0 }, /* 5 */
63
+ {0, 0, 0, 0, 0 }, /* 6 */
64
+ {0, 0, 0, 0, 0 }, /* 7 */
65
+ {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 VK_BACK */
66
+ {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 VK_TAB */
67
+ {0, 0, 0, 0, 0 }, /* 10 */
68
+ {0, 0, 0, 0, 0 }, /* 11 */
69
+ {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 VK_CLEAR */
70
+ {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 VK_RETURN */
71
+ {0, 0, 0, 0, 0 }, /* 14 */
72
+ {0, 0, 0, 0, 0 }, /* 15 */
73
+ {0, 0, 0, 0, 0 }, /* 16 VK_SHIFT HANDLED SEPARATELY */
74
+ {0, 0, 0, 0, 0 }, /* 17 VK_CONTROL HANDLED SEPARATELY */
75
+ {0, 0, 0, 0, 0 }, /* 18 VK_MENU HANDLED SEPARATELY */
76
+ {KEY_PAUSE, KEY_SPAUSE,CTL_PAUSE, 0, 0 }, /* 19 VK_PAUSE */
77
+ {0, 0, 0, 0, 0 }, /* 20 VK_CAPITAL HANDLED SEPARATELY */
78
+ {0, 0, 0, 0, 0 }, /* 21 VK_HANGUL */
79
+ {0, 0, 0, 0, 0 }, /* 22 */
80
+ {0, 0, 0, 0, 0 }, /* 23 VK_JUNJA */
81
+ {0, 0, 0, 0, 0 }, /* 24 VK_FINAL */
82
+ {0, 0, 0, 0, 0 }, /* 25 VK_HANJA */
83
+ {0, 0, 0, 0, 0 }, /* 26 */
84
+ {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 VK_ESCAPE */
85
+ {0, 0, 0, 0, 0 }, /* 28 VK_CONVERT */
86
+ {0, 0, 0, 0, 0 }, /* 29 VK_NONCONVERT */
87
+ {0, 0, 0, 0, 0 }, /* 30 VK_ACCEPT */
88
+ {0, 0, 0, 0, 0 }, /* 31 VK_MODECHANGE */
89
+ {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 VK_SPACE */
90
+ {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 VK_PRIOR */
91
+ {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 VK_NEXT */
92
+ {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 VK_END */
93
+ {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 VK_HOME */
94
+ {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 VK_LEFT */
95
+ {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 VK_UP */
96
+ {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 VK_RIGHT */
97
+ {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 VK_DOWN */
98
+ {0, 0, 0, 0, 0 }, /* 41 VK_SELECT */
99
+ {0, 0, 0, 0, 0 }, /* 42 VK_PRINT */
100
+ {0, 0, 0, 0, 0 }, /* 43 VK_EXECUTE */
101
+ {KEY_PRINTSCREEN, 0, 0, ALT_PRINTSCREEN, 0 }, /* 44 VK_SNAPSHOT*/
102
+ {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 VK_INSERT */
103
+ {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 VK_DELETE */
104
+ {0, 0, 0, 0, 0 }, /* 47 VK_HELP */
105
+ {0x30, 0x29, CTL_0, ALT_0, 0 }, /* 48 */
106
+ {0x31, 0x21, CTL_1, ALT_1, 0 }, /* 49 */
107
+ {0x32, 0x40, CTL_2, ALT_2, 0 }, /* 50 */
108
+ {0x33, 0x23, CTL_3, ALT_3, 0 }, /* 51 */
109
+ {0x34, 0x24, CTL_4, ALT_4, 0 }, /* 52 */
110
+ {0x35, 0x25, CTL_5, ALT_5, 0 }, /* 53 */
111
+ {0x36, 0x5E, CTL_6, ALT_6, 0 }, /* 54 */
112
+ {0x37, 0x26, CTL_7, ALT_7, 0 }, /* 55 */
113
+ {0x38, 0x2A, CTL_8, ALT_8, 0 }, /* 56 */
114
+ {0x39, 0x28, CTL_9, ALT_9, 0 }, /* 57 */
115
+ {0, 0, 0, 0, 0 }, /* 58 */
116
+ {0, 0, 0, 0, 0 }, /* 59 */
117
+ {0, 0, 0, 0, 0 }, /* 60 */
118
+ {0, 0, 0, 0, 0 }, /* 61 */
119
+ {0, 0, 0, 0, 0 }, /* 62 */
120
+ {0, 0, 0, 0, 0 }, /* 63 */
121
+ {0, 0, 0, 0, 0 }, /* 64 */
122
+ {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */
123
+ {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */
124
+ {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */
125
+ {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */
126
+ {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */
127
+ {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */
128
+ {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */
129
+ {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */
130
+ {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */
131
+ {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */
132
+ {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */
133
+ {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */
134
+ {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */
135
+ {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */
136
+ {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */
137
+ {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */
138
+ {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */
139
+ {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */
140
+ {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */
141
+ {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */
142
+ {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */
143
+ {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */
144
+ {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */
145
+ {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */
146
+ {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */
147
+ {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */
148
+ {0, 0, 0, 0, 0 }, /* 91 VK_LWIN */
149
+ {0, 0, 0, 0, 0 }, /* 92 VK_RWIN */
150
+ {KEY_APPS, KEY_SAPPS, CTL_APPS, ALT_APPS, 13 }, /* 93 VK_APPS */
151
+ {0, 0, 0, 0, 0 }, /* 94 */
152
+ {0, 0, 0, 0, 0 }, /* 95 */
153
+ {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 VK_NUMPAD0 */
154
+ {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 VK_NUMPAD1 */
155
+ {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 VK_NUMPAD2 */
156
+ {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 VK_NUMPAD3 */
157
+ {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 VK_NUMPAD4 */
158
+ {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 VK_NUMPAD5 */
159
+ {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 VK_NUMPAD6 */
160
+ {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 VK_NUMPAD7 */
161
+ {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 VK_NUMPAD8 */
162
+ {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 VK_NUMPAD9 */
163
+ {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 VK_MULTIPLY*/
164
+ {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 VK_ADD */
165
+ {0, 0, 0, 0, 0 }, /* 108 VK_SEPARATOR */
166
+ {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999}, /* 109 VK_SUBTRACT*/
167
+ {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 VK_DECIMAL */
168
+ {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 VK_DIVIDE */
169
+ {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 VK_F1 */
170
+ {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 VK_F2 */
171
+ {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 VK_F3 */
172
+ {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 VK_F4 */
173
+ {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 VK_F5 */
174
+ {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 VK_F6 */
175
+ {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 VK_F7 */
176
+ {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 VK_F8 */
177
+ {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 VK_F9 */
178
+ {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 VK_F10 */
179
+ {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 VK_F11 */
180
+ {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 VK_F12 */
181
+
182
+ /* 124 through 218 */
183
+
184
+ {0, 0, 0, 0, 0}, /* 124 VK_F13 */
185
+ {0, 0, 0, 0, 0}, /* 125 VK_F14 */
186
+ {0, 0, 0, 0, 0}, /* 126 VK_F15 */
187
+ {0, 0, 0, 0, 0}, /* 127 VK_F16 */
188
+ {0, 0, 0, 0, 0}, /* 128 VK_F17 */
189
+ {0, 0, 0, 0, 0}, /* 129 VK_F18 */
190
+ {0, 0, 0, 0, 0}, /* 130 VK_F19 */
191
+ {0, 0, 0, 0, 0}, /* 131 VK_F20 */
192
+ {0, 0, 0, 0, 0}, /* 132 VK_F21 */
193
+ {0, 0, 0, 0, 0}, /* 133 VK_F22 */
194
+ {0, 0, 0, 0, 0}, /* 134 VK_F23 */
195
+ {0, 0, 0, 0, 0}, /* 135 VK_F24 */
196
+ {0, 0, 0, 0, 0}, /* 136 unassigned */
197
+ {0, 0, 0, 0, 0}, /* 137 unassigned */
198
+ {0, 0, 0, 0, 0}, /* 138 unassigned */
199
+ {0, 0, 0, 0, 0}, /* 139 unassigned */
200
+ {0, 0, 0, 0, 0}, /* 140 unassigned */
201
+ {0, 0, 0, 0, 0}, /* 141 unassigned */
202
+ {0, 0, 0, 0, 0}, /* 142 unassigned */
203
+ {0, 0, 0, 0, 0}, /* 143 unassigned */
204
+ {0, 0, 0, 0, 0}, /* 144 VK_NUMLOCK */
205
+ {KEY_SCROLLLOCK, 0, 0, ALT_SCROLLLOCK, 0}, /* 145 VKSCROLL */
206
+ {0, 0, 0, 0, 0}, /* 146 OEM specific */
207
+ {0, 0, 0, 0, 0}, /* 147 OEM specific */
208
+ {0, 0, 0, 0, 0}, /* 148 OEM specific */
209
+ {0, 0, 0, 0, 0}, /* 149 OEM specific */
210
+ {0, 0, 0, 0, 0}, /* 150 OEM specific */
211
+ {0, 0, 0, 0, 0}, /* 151 Unassigned */
212
+ {0, 0, 0, 0, 0}, /* 152 Unassigned */
213
+ {0, 0, 0, 0, 0}, /* 153 Unassigned */
214
+ {0, 0, 0, 0, 0}, /* 154 Unassigned */
215
+ {0, 0, 0, 0, 0}, /* 155 Unassigned */
216
+ {0, 0, 0, 0, 0}, /* 156 Unassigned */
217
+ {0, 0, 0, 0, 0}, /* 157 Unassigned */
218
+ {0, 0, 0, 0, 0}, /* 158 Unassigned */
219
+ {0, 0, 0, 0, 0}, /* 159 Unassigned */
220
+ {0, 0, 0, 0, 0}, /* 160 VK_LSHIFT */
221
+ {0, 0, 0, 0, 0}, /* 161 VK_RSHIFT */
222
+ {0, 0, 0, 0, 0}, /* 162 VK_LCONTROL */
223
+ {0, 0, 0, 0, 0}, /* 163 VK_RCONTROL */
224
+ {0, 0, 0, 0, 0}, /* 164 VK_LMENU */
225
+ {0, 0, 0, 0, 0}, /* 165 VK_RMENU */
226
+ {0, 0, 0, 0, 14}, /* 166 VK_BROWSER_BACK */
227
+ {0, 0, 0, 0, 15}, /* 167 VK_BROWSER_FORWARD */
228
+ {0, 0, 0, 0, 16}, /* 168 VK_BROWSER_REFRESH */
229
+ {0, 0, 0, 0, 17}, /* 169 VK_BROWSER_STOP */
230
+ {0, 0, 0, 0, 18}, /* 170 VK_BROWSER_SEARCH */
231
+ {0, 0, 0, 0, 19}, /* 171 VK_BROWSER_FAVORITES */
232
+ {0, 0, 0, 0, 20}, /* 172 VK_BROWSER_HOME */
233
+ {0, 0, 0, 0, 21}, /* 173 VK_VOLUME_MUTE */
234
+ {0, 0, 0, 0, 22}, /* 174 VK_VOLUME_DOWN */
235
+ {0, 0, 0, 0, 23}, /* 175 VK_VOLUME_UP */
236
+ {0, 0, 0, 0, 24}, /* 176 VK_MEDIA_NEXT_TRACK */
237
+ {0, 0, 0, 0, 25}, /* 177 VK_MEDIA_PREV_TRACK */
238
+ {0, 0, 0, 0, 26}, /* 178 VK_MEDIA_STOP */
239
+ {0, 0, 0, 0, 27}, /* 179 VK_MEDIA_PLAY_PAUSE */
240
+ {0, 0, 0, 0, 28}, /* 180 VK_LAUNCH_MAIL */
241
+ {0, 0, 0, 0, 29}, /* 181 VK_LAUNCH_MEDIA_SELECT */
242
+ {0, 0, 0, 0, 30}, /* 182 VK_LAUNCH_APP1 */
243
+ {0, 0, 0, 0, 31}, /* 183 VK_LAUNCH_APP2 */
244
+ {0, 0, 0, 0, 0}, /* 184 Reserved */
245
+ {0, 0, 0, 0, 0}, /* 185 Reserved */
246
+ {';', ':', CTL_SEMICOLON, ALT_SEMICOLON, 0}, /* 186 VK_OEM_1 */
247
+ {'=', '+', CTL_EQUAL, ALT_EQUAL, 0}, /* 187 VK_OEM_PLUS */
248
+ {',', '<', CTL_COMMA, ALT_COMMA, 0}, /* 188 VK_OEM_COMMA */
249
+ {'-', '_', CTL_MINUS, ALT_MINUS, 0}, /* 189 VK_OEM_MINUS */
250
+ {'.', '>', CTL_STOP, ALT_STOP, 0}, /* 190 VK_OEM_PERIOD */
251
+ {'/', '?', CTL_FSLASH, ALT_FSLASH, 0}, /* 191 VK_OEM_2 */
252
+ {'`', '~', CTL_BQUOTE, ALT_BQUOTE, 0}, /* 192 VK_OEM_3 */
253
+ {0, 0, 0, 0, 0}, /* 193 */
254
+ {0, 0, 0, 0, 0}, /* 194 */
255
+ {0, 0, 0, 0, 0}, /* 195 */
256
+ {0, 0, 0, 0, 0}, /* 196 */
257
+ {0, 0, 0, 0, 0}, /* 197 */
258
+ {0, 0, 0, 0, 0}, /* 198 */
259
+ {0, 0, 0, 0, 0}, /* 199 */
260
+ {0, 0, 0, 0, 0}, /* 200 */
261
+ {0, 0, 0, 0, 0}, /* 201 */
262
+ {0, 0, 0, 0, 0}, /* 202 */
263
+ {0, 0, 0, 0, 0}, /* 203 */
264
+ {0, 0, 0, 0, 0}, /* 204 */
265
+ {0, 0, 0, 0, 0}, /* 205 */
266
+ {0, 0, 0, 0, 0}, /* 206 */
267
+ {0, 0, 0, 0, 0}, /* 207 */
268
+ {0, 0, 0, 0, 0}, /* 208 */
269
+ {0, 0, 0, 0, 0}, /* 209 */
270
+ {0, 0, 0, 0, 0}, /* 210 */
271
+ {0, 0, 0, 0, 0}, /* 211 */
272
+ {0, 0, 0, 0, 0}, /* 212 */
273
+ {0, 0, 0, 0, 0}, /* 213 */
274
+ {0, 0, 0, 0, 0}, /* 214 */
275
+ {0, 0, 0, 0, 0}, /* 215 */
276
+ {0, 0, 0, 0, 0}, /* 216 */
277
+ {0, 0, 0, 0, 0}, /* 217 */
278
+ {0, 0, 0, 0, 0}, /* 218 */
279
+ {0x5B, 0x7B, 0x1B, ALT_LBRACKET,0 }, /* 219 VK_OEM_4 */
280
+ {0x5C, 0x7C, 0x1C, ALT_BSLASH, 0 }, /* 220 VK_OEM_5 */
281
+ {0x5D, 0x7D, 0x1D, ALT_RBRACKET,0 }, /* 221 VK_OEM_6 */
282
+ {'\'', '"', 0x27, ALT_FQUOTE, 0 }, /* 222 VK_OEM_7 */
283
+ {0, 0, 0, 0, 0 }, /* 223 VK_OEM_8 */
284
+ {0, 0, 0, 0, 0 }, /* 224 */
285
+ {0, 0, 0, 0, 0 } /* 225 */
286
+ };
287
+
288
+ static const KPTAB ext_kptab[] =
289
+ {
290
+ {0, 0, 0, 0, }, /* 0 MUST BE EMPTY */
291
+ {PADENTER, SHF_PADENTER, CTL_PADENTER, ALT_PADENTER}, /* 1 13 */
292
+ {PADSLASH, SHF_PADSLASH, CTL_PADSLASH, ALT_PADSLASH}, /* 2 111 */
293
+ {KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP }, /* 3 33 */
294
+ {KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN }, /* 4 34 */
295
+ {KEY_END, KEY_SEND, CTL_END, ALT_END }, /* 5 35 */
296
+ {KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME }, /* 6 36 */
297
+ {KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT }, /* 7 37 */
298
+ {KEY_UP, KEY_SUP, CTL_UP, ALT_UP }, /* 8 38 */
299
+ {KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT }, /* 9 39 */
300
+ {KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN }, /* 10 40 */
301
+ {KEY_IC, KEY_SIC, CTL_INS, ALT_INS }, /* 11 45 */
302
+ {KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL }, /* 12 46 */
303
+ {KEY_APPS, KEY_SAPPS , CTL_APPS, ALT_APPS }, /* 13 93 VK_APPS */
304
+ {KEY_BROWSER_BACK, KEY_SBROWSER_BACK, KEY_CBROWSER_BACK, KEY_ABROWSER_BACK, }, /* 14 166 VK_BROWSER_BACK */
305
+ {KEY_BROWSER_FWD, KEY_SBROWSER_FWD, KEY_CBROWSER_FWD, KEY_ABROWSER_FWD, }, /* 15 167 VK_BROWSER_FORWARD */
306
+ {KEY_BROWSER_REF, KEY_SBROWSER_REF, KEY_CBROWSER_REF, KEY_ABROWSER_REF, }, /* 16 168 VK_BROWSER_REFRESH */
307
+ {KEY_BROWSER_STOP, KEY_SBROWSER_STOP, KEY_CBROWSER_STOP, KEY_ABROWSER_STOP, }, /* 17 169 VK_BROWSER_STOP */
308
+ {KEY_SEARCH, KEY_SSEARCH, KEY_CSEARCH, KEY_ASEARCH, }, /* 18 170 VK_BROWSER_SEARCH */
309
+ {KEY_FAVORITES, KEY_SFAVORITES, KEY_CFAVORITES, KEY_AFAVORITES, }, /* 19 171 VK_BROWSER_FAVORITES */
310
+ {KEY_BROWSER_HOME, KEY_SBROWSER_HOME, KEY_CBROWSER_HOME, KEY_ABROWSER_HOME, }, /* 20 172 VK_BROWSER_HOME */
311
+ {KEY_VOLUME_MUTE, KEY_SVOLUME_MUTE, KEY_CVOLUME_MUTE, KEY_AVOLUME_MUTE, }, /* 21 173 VK_VOLUME_MUTE */
312
+ {KEY_VOLUME_DOWN, KEY_SVOLUME_DOWN, KEY_CVOLUME_DOWN, KEY_AVOLUME_DOWN, }, /* 22 174 VK_VOLUME_DOWN */
313
+ {KEY_VOLUME_UP, KEY_SVOLUME_UP, KEY_CVOLUME_UP, KEY_AVOLUME_UP, }, /* 23 175 VK_VOLUME_UP */
314
+ {KEY_NEXT_TRACK, KEY_SNEXT_TRACK, KEY_CNEXT_TRACK, KEY_ANEXT_TRACK, }, /* 24 176 VK_MEDIA_NEXT_TRACK */
315
+ {KEY_PREV_TRACK, KEY_SPREV_TRACK, KEY_CPREV_TRACK, KEY_APREV_TRACK, }, /* 25 177 VK_MEDIA_PREV_TRACK */
316
+ {KEY_MEDIA_STOP, KEY_SMEDIA_STOP, KEY_CMEDIA_STOP, KEY_AMEDIA_STOP, }, /* 26 178 VK_MEDIA_STOP */
317
+ {KEY_PLAY_PAUSE, KEY_SPLAY_PAUSE, KEY_CPLAY_PAUSE, KEY_APLAY_PAUSE, }, /* 27 179 VK_MEDIA_PLAY_PAUSE */
318
+ {KEY_LAUNCH_MAIL, KEY_SLAUNCH_MAIL, KEY_CLAUNCH_MAIL, KEY_ALAUNCH_MAIL, }, /* 28 180 VK_LAUNCH_MAIL */
319
+ {KEY_MEDIA_SELECT, KEY_SMEDIA_SELECT, KEY_CMEDIA_SELECT, KEY_AMEDIA_SELECT, }, /* 29 181 VK_LAUNCH_MEDIA_SELECT */
320
+ {KEY_LAUNCH_APP1, KEY_SLAUNCH_APP1, KEY_CLAUNCH_APP1, KEY_ALAUNCH_APP1, }, /* 30 182 VK_LAUNCH_APP1 */
321
+ {KEY_LAUNCH_APP2, KEY_SLAUNCH_APP2, KEY_CLAUNCH_APP2, KEY_ALAUNCH_APP2, }, /* 31 183 VK_LAUNCH_APP2 */
322
+ };
323
+
324
+ /* End of kptab[] */
325
+
326
+ unsigned long PDC_get_input_fd(void)
327
+ {
328
+ PDC_LOG(("PDC_get_input_fd() - called\n"));
329
+
330
+ return 0L;
331
+ }
332
+
333
+ void PDC_set_keyboard_binary(bool on)
334
+ {
335
+ PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
336
+ }
337
+
338
+ /* check if a key or mouse event is waiting */
339
+
340
+ bool PDC_check_key(void)
341
+ {
342
+ if (key_count > 0)
343
+ return TRUE;
344
+
345
+ GetNumberOfConsoleInputEvents(pdc_con_in, &event_count);
346
+
347
+ return (event_count != 0);
348
+ }
349
+
350
+ /* _get_key_count returns 0 if save_ip doesn't contain an event which
351
+ should be passed back to the user. This function filters "useless"
352
+ events.
353
+
354
+ The function returns the number of keys waiting. This may be > 1
355
+ if the repetition of real keys pressed so far are > 1.
356
+
357
+ Returns 0 on NUMLOCK, CAPSLOCK, SCROLLLOCK.
358
+
359
+ Returns 1 for SHIFT, ALT, CTRL only if no other key has been pressed
360
+ in between, and SP->return_key_modifiers is set; these are returned
361
+ on keyup.
362
+
363
+ Normal keys are returned on keydown only. The number of repetitions
364
+ are returned. Dead keys (diacritics) are omitted. See below for a
365
+ description.
366
+ */
367
+
368
+ static int repeat_count = 0;
369
+
370
+ static int _get_key_count(void)
371
+ {
372
+ int num_keys = 0, vk;
373
+ static int prev_vk = 0;
374
+
375
+ PDC_LOG(("_get_key_count() - called\n"));
376
+
377
+ vk = KEV.wVirtualKeyCode;
378
+
379
+ if (KEV.bKeyDown)
380
+ {
381
+ /* key down */
382
+
383
+ save_press = 0;
384
+
385
+ if (vk == VK_CAPITAL || vk == VK_NUMLOCK || vk == VK_SCROLL)
386
+ {
387
+ /* throw away these modifiers */
388
+ }
389
+ else if (vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU)
390
+ {
391
+ /* These keys are returned on keyup only. */
392
+
393
+ save_press = vk;
394
+ switch (vk)
395
+ {
396
+ case VK_SHIFT:
397
+ left_key = GetKeyState(VK_LSHIFT);
398
+ break;
399
+ case VK_CONTROL:
400
+ left_key = GetKeyState(VK_LCONTROL);
401
+ break;
402
+ case VK_MENU:
403
+ left_key = GetKeyState(VK_LMENU);
404
+ }
405
+ }
406
+ else
407
+ {
408
+ /* Check for diacritics. These are dead keys. Some locales
409
+ have modified characters like umlaut-a, which is an "a"
410
+ with two dots on it. In some locales you have to press a
411
+ special key (the dead key) immediately followed by the
412
+ "a" to get a composed umlaut-a. The special key may have
413
+ a normal meaning with different modifiers. */
414
+
415
+ if (KEV.uChar.UnicodeChar || !(MapVirtualKey(vk, 2) & 0x80000000))
416
+ num_keys = KEV.wRepeatCount;
417
+ }
418
+ if( vk == prev_vk)
419
+ repeat_count++;
420
+ else
421
+ repeat_count = 0;
422
+ prev_vk = vk;
423
+ }
424
+ else
425
+ {
426
+ /* key up */
427
+
428
+ /* Only modifier keys or the results of ALT-numpad entry are
429
+ returned on keyup */
430
+
431
+ if ((vk == VK_MENU && KEV.uChar.UnicodeChar) ||
432
+ ((vk == VK_SHIFT || vk == VK_CONTROL || vk == VK_MENU) &&
433
+ vk == save_press))
434
+ {
435
+ save_press = 0;
436
+ num_keys = 1;
437
+ }
438
+ repeat_count = prev_vk = 0;
439
+ }
440
+
441
+ PDC_LOG(("_get_key_count() - returning: num_keys %d\n", num_keys));
442
+
443
+ return num_keys;
444
+ }
445
+
446
+ /* _process_key_event returns -1 if the key in save_ip should be
447
+ ignored. Otherwise it returns the keycode which should be returned
448
+ by PDC_get_key(). save_ip must be a key event.
449
+
450
+ CTRL-ALT support has been disabled, when is it emitted plainly? */
451
+
452
+ static int _process_key_event(void)
453
+ {
454
+ int key = (unsigned short)KEV.uChar.UnicodeChar;
455
+ WORD vk = KEV.wVirtualKeyCode;
456
+ DWORD state = KEV.dwControlKeyState;
457
+
458
+ int idx;
459
+ BOOL enhanced;
460
+
461
+ SP->key_code = TRUE;
462
+
463
+ /* Save the key modifiers if required. Do this first to allow to
464
+ detect e.g. a pressed CTRL key after a hit of NUMLOCK. */
465
+
466
+ if (SP->save_key_modifiers)
467
+ {
468
+ if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED))
469
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
470
+
471
+ if (state & SHIFT_PRESSED)
472
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
473
+
474
+ if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
475
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
476
+
477
+ if (state & NUMLOCK_ON)
478
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
479
+
480
+ if( repeat_count)
481
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_REPEAT;
482
+ }
483
+
484
+ /* Handle modifier keys hit by themselves */
485
+
486
+ switch (vk)
487
+ {
488
+ case VK_SHIFT: /* shift */
489
+ if (!SP->return_key_modifiers)
490
+ return -1;
491
+
492
+ return (left_key & 0x8000) ? KEY_SHIFT_L : KEY_SHIFT_R;
493
+
494
+ case VK_CONTROL: /* control */
495
+ if (!SP->return_key_modifiers)
496
+ return -1;
497
+
498
+ return (left_key & 0x8000) ? KEY_CONTROL_L : KEY_CONTROL_R;
499
+
500
+ case VK_MENU: /* alt */
501
+ if (!key)
502
+ {
503
+ if (!SP->return_key_modifiers)
504
+ return -1;
505
+
506
+ return (left_key & 0x8000) ? KEY_ALT_L : KEY_ALT_R;
507
+ }
508
+ }
509
+
510
+ /* The system may emit Ascii or Unicode characters depending on
511
+ whether ReadConsoleInputA or ReadConsoleInputW is used.
512
+
513
+ Normally, if key != 0 then the system did the translation
514
+ successfully. But this is not true for LEFT_ALT (different to
515
+ RIGHT_ALT). In case of LEFT_ALT we can get key != 0. So
516
+ check for this first. */
517
+
518
+ if (key && ( !(state & LEFT_ALT_PRESSED) ||
519
+ (state & RIGHT_ALT_PRESSED) ))
520
+ {
521
+ /* This code should catch all keys returning a printable
522
+ character. Characters above 0x7F should be returned as
523
+ positive codes. */
524
+
525
+ if (kptab[vk].extended == 0)
526
+ {
527
+ SP->key_code = FALSE;
528
+ return key;
529
+ }
530
+ }
531
+
532
+ /* This case happens if a functional key has been entered. */
533
+
534
+ if ((state & ENHANCED_KEY) && (kptab[vk].extended != 999))
535
+ {
536
+ enhanced = TRUE;
537
+ idx = kptab[vk].extended;
538
+ }
539
+ else
540
+ {
541
+ enhanced = FALSE;
542
+ idx = vk;
543
+ }
544
+
545
+ if (state & SHIFT_PRESSED)
546
+ key = enhanced ? ext_kptab[idx].shift : kptab[idx].shift;
547
+
548
+ else if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
549
+ key = enhanced ? ext_kptab[idx].control : kptab[idx].control;
550
+
551
+ else if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED))
552
+ key = enhanced ? ext_kptab[idx].alt : kptab[idx].alt;
553
+
554
+ else
555
+ key = enhanced ? ext_kptab[idx].normal : kptab[idx].normal;
556
+
557
+ if (key < KEY_CODE_YES)
558
+ SP->key_code = FALSE;
559
+
560
+ return key;
561
+ }
562
+
563
+ static int _process_mouse_event(void)
564
+ {
565
+ static const DWORD button_mask[] = {1, 4, 2};
566
+ short action, shift_flags = 0;
567
+ int i;
568
+
569
+ save_press = 0;
570
+ SP->key_code = TRUE;
571
+
572
+ memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS));
573
+
574
+ /* Handle scroll wheel */
575
+
576
+ if (MEV.dwEventFlags == 4)
577
+ {
578
+ pdc_mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ?
579
+ PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP;
580
+
581
+ pdc_mouse_status.x = -1;
582
+ pdc_mouse_status.y = -1;
583
+
584
+ memset(&old_mouse_status, 0, sizeof(old_mouse_status));
585
+
586
+ return KEY_MOUSE;
587
+ }
588
+
589
+ if (MEV.dwEventFlags == 8)
590
+ {
591
+ pdc_mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ?
592
+ PDC_MOUSE_WHEEL_RIGHT : PDC_MOUSE_WHEEL_LEFT;
593
+
594
+ pdc_mouse_status.x = -1;
595
+ pdc_mouse_status.y = -1;
596
+
597
+ memset(&old_mouse_status, 0, sizeof(old_mouse_status));
598
+
599
+ return KEY_MOUSE;
600
+ }
601
+
602
+ action = (MEV.dwEventFlags == 2) ? BUTTON_DOUBLE_CLICKED :
603
+ ((MEV.dwEventFlags == 1) ? BUTTON_MOVED : BUTTON_PRESSED);
604
+
605
+ for (i = 0; i < 3; i++)
606
+ pdc_mouse_status.button[i] =
607
+ (MEV.dwButtonState & button_mask[i]) ? action : 0;
608
+
609
+ if (action == BUTTON_PRESSED && MEV.dwButtonState & 7 && SP->mouse_wait)
610
+ {
611
+ /* Check for a click -- a PRESS followed immediately by a release */
612
+
613
+ if (!event_count)
614
+ {
615
+ napms(SP->mouse_wait);
616
+
617
+ GetNumberOfConsoleInputEvents(pdc_con_in, &event_count);
618
+ }
619
+
620
+ if (event_count)
621
+ {
622
+ INPUT_RECORD ip;
623
+ DWORD count;
624
+ bool have_click = FALSE;
625
+
626
+ PeekConsoleInput(pdc_con_in, &ip, 1, &count);
627
+
628
+ for (i = 0; i < 3; i++)
629
+ {
630
+ if (pdc_mouse_status.button[i] == BUTTON_PRESSED &&
631
+ !(ip.Event.MouseEvent.dwButtonState & button_mask[i]))
632
+ {
633
+ pdc_mouse_status.button[i] = BUTTON_CLICKED;
634
+ have_click = TRUE;
635
+ }
636
+ }
637
+
638
+ /* If a click was found, throw out the event */
639
+
640
+ if (have_click)
641
+ ReadConsoleInput(pdc_con_in, &ip, 1, &count);
642
+ }
643
+ }
644
+
645
+ pdc_mouse_status.x = MEV.dwMousePosition.X;
646
+ pdc_mouse_status.y = MEV.dwMousePosition.Y;
647
+
648
+ pdc_mouse_status.changes = 0;
649
+
650
+ for (i = 0; i < 3; i++)
651
+ {
652
+ if (old_mouse_status.button[i] != pdc_mouse_status.button[i])
653
+ pdc_mouse_status.changes |= (1 << i);
654
+
655
+ if (pdc_mouse_status.button[i] == BUTTON_MOVED)
656
+ {
657
+ /* Discard non-moved "moves" */
658
+
659
+ if (pdc_mouse_status.x == old_mouse_status.x &&
660
+ pdc_mouse_status.y == old_mouse_status.y)
661
+ return -1;
662
+
663
+ /* Motion events always flag the button as changed */
664
+
665
+ pdc_mouse_status.changes |= (1 << i);
666
+ pdc_mouse_status.changes |= PDC_MOUSE_MOVED;
667
+ break;
668
+ }
669
+ }
670
+
671
+ old_mouse_status = pdc_mouse_status;
672
+
673
+ /* Treat click events as release events for comparison purposes */
674
+
675
+ for (i = 0; i < 3; i++)
676
+ {
677
+ if (old_mouse_status.button[i] == BUTTON_CLICKED ||
678
+ old_mouse_status.button[i] == BUTTON_DOUBLE_CLICKED)
679
+ old_mouse_status.button[i] = BUTTON_RELEASED;
680
+ }
681
+
682
+ /* Check for SHIFT/CONTROL/ALT */
683
+
684
+ if (MEV.dwControlKeyState & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED))
685
+ shift_flags |= BUTTON_ALT;
686
+
687
+ if (MEV.dwControlKeyState & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
688
+ shift_flags |= BUTTON_CONTROL;
689
+
690
+ if (MEV.dwControlKeyState & SHIFT_PRESSED)
691
+ shift_flags |= BUTTON_SHIFT;
692
+
693
+ if (shift_flags)
694
+ {
695
+ for (i = 0; i < 3; i++)
696
+ {
697
+ if (pdc_mouse_status.changes & (1 << i))
698
+ pdc_mouse_status.button[i] |= shift_flags;
699
+ }
700
+ }
701
+
702
+ return KEY_MOUSE;
703
+ }
704
+
705
+ int pdc_resizeX, pdc_resizeY;
706
+
707
+ /* return the next available key or mouse event */
708
+
709
+ int PDC_get_key(void)
710
+ {
711
+ pdc_key_modifiers = 0L;
712
+
713
+ if (!key_count)
714
+ {
715
+ DWORD count;
716
+
717
+ ReadConsoleInput(pdc_con_in, &save_ip, 1, &count);
718
+ event_count--;
719
+
720
+ if (save_ip.EventType == MOUSE_EVENT ||
721
+ save_ip.EventType == WINDOW_BUFFER_SIZE_EVENT)
722
+ key_count = 1;
723
+ else if (save_ip.EventType == KEY_EVENT)
724
+ key_count = _get_key_count();
725
+ else if (save_ip.EventType == WINDOW_BUFFER_SIZE_EVENT)
726
+ key_count = 1;
727
+ }
728
+
729
+ if (key_count)
730
+ {
731
+ key_count--;
732
+
733
+ switch (save_ip.EventType)
734
+ {
735
+ case KEY_EVENT:
736
+ return _process_key_event();
737
+
738
+ case MOUSE_EVENT:
739
+ return _process_mouse_event();
740
+
741
+ case WINDOW_BUFFER_SIZE_EVENT:
742
+ if (REV.dwSize.Y != LINES || REV.dwSize.X != COLS)
743
+ {
744
+ if (!SP->resized)
745
+ {
746
+ SP->resized = TRUE;
747
+ SP->key_code = TRUE;
748
+ return KEY_RESIZE;
749
+ }
750
+ }
751
+ }
752
+ }
753
+
754
+ return -1;
755
+ }
756
+
757
+ /* discard any pending keyboard or mouse input -- this is the core
758
+ routine for flushinp() */
759
+
760
+ void PDC_flushinp(void)
761
+ {
762
+ PDC_LOG(("PDC_flushinp() - called\n"));
763
+
764
+ FlushConsoleInputBuffer(pdc_con_in);
765
+ }
766
+
767
+ int PDC_mouse_set(void)
768
+ {
769
+ /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear
770
+ all other flags, including the extended flags;
771
+ If turning off the mouse: Set QuickEdit Mode to the status it
772
+ had on startup, and clear all other flags */
773
+
774
+ SetConsoleMode(pdc_con_in, SP->_trap_mbe ?
775
+ (ENABLE_MOUSE_INPUT|0x0088) : (pdc_quick_edit|0x0088));
776
+
777
+ memset(&old_mouse_status, 0, sizeof(old_mouse_status));
778
+
779
+ return OK;
780
+ }
781
+
782
+ int PDC_modifiers_set(void)
783
+ {
784
+ return OK;
785
+ }
786
+