curses 1.4.4 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/macos.yml +1 -1
  4. data/.github/workflows/push_gem.yml +48 -0
  5. data/.github/workflows/ubuntu.yml +2 -2
  6. data/.github/workflows/windows.yml +2 -2
  7. data/History.md +23 -0
  8. data/README.md +7 -0
  9. data/curses.gemspec +1 -1
  10. data/ext/curses/curses.c +7 -7
  11. data/sample/colors.rb +6 -1
  12. data/sample/form.rb +1 -1
  13. data/sample/menu.rb +2 -0
  14. metadata +9 -251
  15. data/vendor/PDCurses/.gitignore +0 -47
  16. data/vendor/PDCurses/.travis.yml +0 -49
  17. data/vendor/PDCurses/CMakeLists.txt +0 -68
  18. data/vendor/PDCurses/HISTORY.md +0 -2036
  19. data/vendor/PDCurses/IMPLEMNT.md +0 -327
  20. data/vendor/PDCurses/Makefile +0 -27
  21. data/vendor/PDCurses/README.md +0 -77
  22. data/vendor/PDCurses/acs_defs.h +0 -265
  23. data/vendor/PDCurses/appveyor.yml +0 -218
  24. data/vendor/PDCurses/cmake/README.md +0 -71
  25. data/vendor/PDCurses/cmake/build_dependencies.cmake +0 -178
  26. data/vendor/PDCurses/cmake/build_options.cmake +0 -25
  27. data/vendor/PDCurses/cmake/dll_version.cmake +0 -26
  28. data/vendor/PDCurses/cmake/gen_config_header.cmake +0 -43
  29. data/vendor/PDCurses/cmake/get_version.cmake +0 -17
  30. data/vendor/PDCurses/cmake/make_uninstall.cmake +0 -19
  31. data/vendor/PDCurses/cmake/project_common.cmake +0 -121
  32. data/vendor/PDCurses/cmake/resource.in.cmake +0 -52
  33. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +0 -83
  34. data/vendor/PDCurses/cmake/target_arch.cmake +0 -36
  35. data/vendor/PDCurses/cmake/version.in.cmake +0 -73
  36. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +0 -96
  37. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +0 -106
  38. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +0 -105
  39. data/vendor/PDCurses/curses.h +0 -1846
  40. data/vendor/PDCurses/curspriv.h +0 -134
  41. data/vendor/PDCurses/demos/README.md +0 -25
  42. data/vendor/PDCurses/demos/firework.c +0 -144
  43. data/vendor/PDCurses/demos/newtest.c +0 -581
  44. data/vendor/PDCurses/demos/ozdemo.c +0 -447
  45. data/vendor/PDCurses/demos/ptest.c +0 -283
  46. data/vendor/PDCurses/demos/rain.c +0 -157
  47. data/vendor/PDCurses/demos/testcurs.c +0 -1607
  48. data/vendor/PDCurses/demos/tui.c +0 -1048
  49. data/vendor/PDCurses/demos/tui.h +0 -65
  50. data/vendor/PDCurses/demos/tuidemo.c +0 -233
  51. data/vendor/PDCurses/demos/version.c +0 -61
  52. data/vendor/PDCurses/demos/worm.c +0 -432
  53. data/vendor/PDCurses/demos/xmas.c +0 -955
  54. data/vendor/PDCurses/dos/CMakeLists.txt +0 -47
  55. data/vendor/PDCurses/dos/Makefile +0 -105
  56. data/vendor/PDCurses/dos/Makefile.bcc +0 -83
  57. data/vendor/PDCurses/dos/Makefile.dmc +0 -257
  58. data/vendor/PDCurses/dos/Makefile.msc +0 -113
  59. data/vendor/PDCurses/dos/Makefile.wcc +0 -107
  60. data/vendor/PDCurses/dos/README.md +0 -51
  61. data/vendor/PDCurses/dos/bccdos.lrf +0 -9
  62. data/vendor/PDCurses/dos/mscdos.lrf +0 -50
  63. data/vendor/PDCurses/dos/pdcclip.c +0 -132
  64. data/vendor/PDCurses/dos/pdcdisp.c +0 -135
  65. data/vendor/PDCurses/dos/pdcdos.h +0 -194
  66. data/vendor/PDCurses/dos/pdcgetsc.c +0 -98
  67. data/vendor/PDCurses/dos/pdckbd.c +0 -513
  68. data/vendor/PDCurses/dos/pdcscrn.c +0 -785
  69. data/vendor/PDCurses/dos/pdcsetsc.c +0 -101
  70. data/vendor/PDCurses/dos/pdcutil.c +0 -212
  71. data/vendor/PDCurses/libobjs.mif +0 -26
  72. data/vendor/PDCurses/makedist.mif +0 -20
  73. data/vendor/PDCurses/man/Makefile +0 -37
  74. data/vendor/PDCurses/man/README.md +0 -21
  75. data/vendor/PDCurses/man/intro.md +0 -361
  76. data/vendor/PDCurses/man/manext.c +0 -119
  77. data/vendor/PDCurses/man/sdl.md +0 -152
  78. data/vendor/PDCurses/man/sdl2.md +0 -58
  79. data/vendor/PDCurses/man/x11.md +0 -407
  80. data/vendor/PDCurses/ncurses/CMakeLists.txt +0 -66
  81. data/vendor/PDCurses/ncurses/README.md +0 -26
  82. data/vendor/PDCurses/ncurses/makefile +0 -29
  83. data/vendor/PDCurses/os2/CMakeLists.txt +0 -41
  84. data/vendor/PDCurses/os2/Makefile +0 -132
  85. data/vendor/PDCurses/os2/Makefile.bcc +0 -90
  86. data/vendor/PDCurses/os2/Makefile.wcc +0 -43
  87. data/vendor/PDCurses/os2/README.md +0 -43
  88. data/vendor/PDCurses/os2/iccos2.lrf +0 -50
  89. data/vendor/PDCurses/os2/iccos2.mak +0 -256
  90. data/vendor/PDCurses/os2/pdcclip.c +0 -188
  91. data/vendor/PDCurses/os2/pdcdisp.c +0 -93
  92. data/vendor/PDCurses/os2/pdcgetsc.c +0 -89
  93. data/vendor/PDCurses/os2/pdckbd.c +0 -521
  94. data/vendor/PDCurses/os2/pdcos2.h +0 -55
  95. data/vendor/PDCurses/os2/pdcscrn.c +0 -449
  96. data/vendor/PDCurses/os2/pdcsetsc.c +0 -112
  97. data/vendor/PDCurses/os2/pdcutil.c +0 -52
  98. data/vendor/PDCurses/panel.h +0 -56
  99. data/vendor/PDCurses/pdcurses/README.md +0 -25
  100. data/vendor/PDCurses/pdcurses/addch.c +0 -693
  101. data/vendor/PDCurses/pdcurses/addchstr.c +0 -245
  102. data/vendor/PDCurses/pdcurses/addstr.c +0 -240
  103. data/vendor/PDCurses/pdcurses/attr.c +0 -359
  104. data/vendor/PDCurses/pdcurses/beep.c +0 -68
  105. data/vendor/PDCurses/pdcurses/bkgd.c +0 -223
  106. data/vendor/PDCurses/pdcurses/border.c +0 -411
  107. data/vendor/PDCurses/pdcurses/clear.c +0 -159
  108. data/vendor/PDCurses/pdcurses/color.c +0 -298
  109. data/vendor/PDCurses/pdcurses/debug.c +0 -109
  110. data/vendor/PDCurses/pdcurses/delch.c +0 -96
  111. data/vendor/PDCurses/pdcurses/deleteln.c +0 -211
  112. data/vendor/PDCurses/pdcurses/deprec.c +0 -27
  113. data/vendor/PDCurses/pdcurses/getch.c +0 -417
  114. data/vendor/PDCurses/pdcurses/getstr.c +0 -474
  115. data/vendor/PDCurses/pdcurses/getyx.c +0 -139
  116. data/vendor/PDCurses/pdcurses/inch.c +0 -127
  117. data/vendor/PDCurses/pdcurses/inchstr.c +0 -214
  118. data/vendor/PDCurses/pdcurses/initscr.c +0 -367
  119. data/vendor/PDCurses/pdcurses/inopts.c +0 -324
  120. data/vendor/PDCurses/pdcurses/insch.c +0 -271
  121. data/vendor/PDCurses/pdcurses/insstr.c +0 -264
  122. data/vendor/PDCurses/pdcurses/instr.c +0 -246
  123. data/vendor/PDCurses/pdcurses/kernel.c +0 -259
  124. data/vendor/PDCurses/pdcurses/keyname.c +0 -157
  125. data/vendor/PDCurses/pdcurses/mouse.c +0 -438
  126. data/vendor/PDCurses/pdcurses/move.c +0 -57
  127. data/vendor/PDCurses/pdcurses/outopts.c +0 -159
  128. data/vendor/PDCurses/pdcurses/overlay.c +0 -214
  129. data/vendor/PDCurses/pdcurses/pad.c +0 -260
  130. data/vendor/PDCurses/pdcurses/panel.c +0 -633
  131. data/vendor/PDCurses/pdcurses/printw.c +0 -126
  132. data/vendor/PDCurses/pdcurses/refresh.c +0 -279
  133. data/vendor/PDCurses/pdcurses/scanw.c +0 -578
  134. data/vendor/PDCurses/pdcurses/scr_dump.c +0 -213
  135. data/vendor/PDCurses/pdcurses/scroll.c +0 -101
  136. data/vendor/PDCurses/pdcurses/slk.c +0 -591
  137. data/vendor/PDCurses/pdcurses/termattr.c +0 -182
  138. data/vendor/PDCurses/pdcurses/terminfo.c +0 -217
  139. data/vendor/PDCurses/pdcurses/touch.c +0 -163
  140. data/vendor/PDCurses/pdcurses/util.c +0 -312
  141. data/vendor/PDCurses/pdcurses/window.c +0 -569
  142. data/vendor/PDCurses/sdl1/Makefile +0 -129
  143. data/vendor/PDCurses/sdl1/Makefile.mng +0 -110
  144. data/vendor/PDCurses/sdl1/README.md +0 -31
  145. data/vendor/PDCurses/sdl1/deffont.h +0 -385
  146. data/vendor/PDCurses/sdl1/deficon.h +0 -23
  147. data/vendor/PDCurses/sdl1/pdcclip.c +0 -131
  148. data/vendor/PDCurses/sdl1/pdcdisp.c +0 -373
  149. data/vendor/PDCurses/sdl1/pdcgetsc.c +0 -30
  150. data/vendor/PDCurses/sdl1/pdckbd.c +0 -405
  151. data/vendor/PDCurses/sdl1/pdcscrn.c +0 -414
  152. data/vendor/PDCurses/sdl1/pdcsdl.h +0 -31
  153. data/vendor/PDCurses/sdl1/pdcsetsc.c +0 -64
  154. data/vendor/PDCurses/sdl1/pdcutil.c +0 -40
  155. data/vendor/PDCurses/sdl1/sdltest.c +0 -79
  156. data/vendor/PDCurses/sdl2/CMakeLists.txt +0 -76
  157. data/vendor/PDCurses/sdl2/Makefile +0 -135
  158. data/vendor/PDCurses/sdl2/Makefile.vc +0 -164
  159. data/vendor/PDCurses/sdl2/README.md +0 -34
  160. data/vendor/PDCurses/sdl2/deffont.h +0 -385
  161. data/vendor/PDCurses/sdl2/deficon.h +0 -23
  162. data/vendor/PDCurses/sdl2/pdcclip.c +0 -93
  163. data/vendor/PDCurses/sdl2/pdcdisp.c +0 -534
  164. data/vendor/PDCurses/sdl2/pdcgetsc.c +0 -30
  165. data/vendor/PDCurses/sdl2/pdckbd.c +0 -480
  166. data/vendor/PDCurses/sdl2/pdcscrn.c +0 -443
  167. data/vendor/PDCurses/sdl2/pdcsdl.h +0 -33
  168. data/vendor/PDCurses/sdl2/pdcsetsc.c +0 -67
  169. data/vendor/PDCurses/sdl2/pdcutil.c +0 -39
  170. data/vendor/PDCurses/sdl2/sdltest.c +0 -81
  171. data/vendor/PDCurses/term.h +0 -48
  172. data/vendor/PDCurses/version.mif +0 -7
  173. data/vendor/PDCurses/vt/CMakeLists.txt +0 -28
  174. data/vendor/PDCurses/vt/Makefile +0 -135
  175. data/vendor/PDCurses/vt/Makefile.bcc +0 -111
  176. data/vendor/PDCurses/vt/Makefile.dmc +0 -258
  177. data/vendor/PDCurses/vt/Makefile.vc +0 -144
  178. data/vendor/PDCurses/vt/Makefile.wcc +0 -107
  179. data/vendor/PDCurses/vt/README.md +0 -64
  180. data/vendor/PDCurses/vt/pdcclip.c +0 -20
  181. data/vendor/PDCurses/vt/pdcdisp.c +0 -284
  182. data/vendor/PDCurses/vt/pdcgetsc.c +0 -27
  183. data/vendor/PDCurses/vt/pdckbd.c +0 -394
  184. data/vendor/PDCurses/vt/pdcscrn.c +0 -434
  185. data/vendor/PDCurses/vt/pdcsetsc.c +0 -45
  186. data/vendor/PDCurses/vt/pdcutil.c +0 -43
  187. data/vendor/PDCurses/vt/pdcvt.h +0 -16
  188. data/vendor/PDCurses/watcom.mif +0 -68
  189. data/vendor/PDCurses/wincon/CMakeLists.txt +0 -27
  190. data/vendor/PDCurses/wincon/Makefile.bcc +0 -88
  191. data/vendor/PDCurses/wincon/Makefile.dmc +0 -256
  192. data/vendor/PDCurses/wincon/Makefile.lcc +0 -273
  193. data/vendor/PDCurses/wincon/Makefile.mng +0 -176
  194. data/vendor/PDCurses/wincon/Makefile.vc +0 -144
  195. data/vendor/PDCurses/wincon/Makefile.wcc +0 -51
  196. data/vendor/PDCurses/wincon/README.md +0 -85
  197. data/vendor/PDCurses/wincon/pdcclip.c +0 -174
  198. data/vendor/PDCurses/wincon/pdcdisp.c +0 -143
  199. data/vendor/PDCurses/wincon/pdcgetsc.c +0 -55
  200. data/vendor/PDCurses/wincon/pdckbd.c +0 -786
  201. data/vendor/PDCurses/wincon/pdcscrn.c +0 -717
  202. data/vendor/PDCurses/wincon/pdcsetsc.c +0 -91
  203. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  204. data/vendor/PDCurses/wincon/pdcurses.rc +0 -28
  205. data/vendor/PDCurses/wincon/pdcutil.c +0 -41
  206. data/vendor/PDCurses/wincon/pdcwin.h +0 -31
  207. data/vendor/PDCurses/wingui/CMakeLists.txt +0 -27
  208. data/vendor/PDCurses/wingui/Makefile.bcc +0 -85
  209. data/vendor/PDCurses/wingui/Makefile.dmc +0 -259
  210. data/vendor/PDCurses/wingui/Makefile.lcc +0 -273
  211. data/vendor/PDCurses/wingui/Makefile.mng +0 -171
  212. data/vendor/PDCurses/wingui/Makefile.vc +0 -144
  213. data/vendor/PDCurses/wingui/Makefile.wcc +0 -51
  214. data/vendor/PDCurses/wingui/README.md +0 -93
  215. data/vendor/PDCurses/wingui/pdcclip.c +0 -174
  216. data/vendor/PDCurses/wingui/pdcdisp.c +0 -718
  217. data/vendor/PDCurses/wingui/pdcgetsc.c +0 -30
  218. data/vendor/PDCurses/wingui/pdckbd.c +0 -143
  219. data/vendor/PDCurses/wingui/pdcscrn.c +0 -2797
  220. data/vendor/PDCurses/wingui/pdcsetsc.c +0 -89
  221. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  222. data/vendor/PDCurses/wingui/pdcurses.rc +0 -28
  223. data/vendor/PDCurses/wingui/pdcutil.c +0 -61
  224. data/vendor/PDCurses/wingui/pdcwin.h +0 -122
  225. data/vendor/PDCurses/x11/Makefile.in +0 -754
  226. data/vendor/PDCurses/x11/PDCurses.spec +0 -82
  227. data/vendor/PDCurses/x11/README.md +0 -62
  228. data/vendor/PDCurses/x11/ScrollBox.c +0 -319
  229. data/vendor/PDCurses/x11/ScrollBox.h +0 -51
  230. data/vendor/PDCurses/x11/ScrollBoxP.h +0 -70
  231. data/vendor/PDCurses/x11/aclocal.m4 +0 -994
  232. data/vendor/PDCurses/x11/big_icon.xbm +0 -46
  233. data/vendor/PDCurses/x11/compose.h +0 -201
  234. data/vendor/PDCurses/x11/config.guess +0 -1500
  235. data/vendor/PDCurses/x11/config.h.in +0 -100
  236. data/vendor/PDCurses/x11/config.sub +0 -1616
  237. data/vendor/PDCurses/x11/configure +0 -6700
  238. data/vendor/PDCurses/x11/configure.ac +0 -295
  239. data/vendor/PDCurses/x11/debian/changelog +0 -6
  240. data/vendor/PDCurses/x11/debian/compat +0 -1
  241. data/vendor/PDCurses/x11/debian/control +0 -11
  242. data/vendor/PDCurses/x11/debian/copyright +0 -27
  243. data/vendor/PDCurses/x11/debian/rules +0 -98
  244. data/vendor/PDCurses/x11/install-sh +0 -253
  245. data/vendor/PDCurses/x11/little_icon.xbm +0 -14
  246. data/vendor/PDCurses/x11/ncurses_cfg.h +0 -45
  247. data/vendor/PDCurses/x11/pdcclip.c +0 -173
  248. data/vendor/PDCurses/x11/pdcdisp.c +0 -85
  249. data/vendor/PDCurses/x11/pdcgetsc.c +0 -28
  250. data/vendor/PDCurses/x11/pdckbd.c +0 -104
  251. data/vendor/PDCurses/x11/pdcscrn.c +0 -258
  252. data/vendor/PDCurses/x11/pdcsetsc.c +0 -95
  253. data/vendor/PDCurses/x11/pdcutil.c +0 -52
  254. data/vendor/PDCurses/x11/pdcx11.c +0 -316
  255. data/vendor/PDCurses/x11/pdcx11.h +0 -191
  256. data/vendor/PDCurses/x11/sb.c +0 -155
  257. data/vendor/PDCurses/x11/x11.c +0 -3686
  258. data/vendor/PDCurses/x11/xcurses-config.in +0 -81
@@ -1,786 +0,0 @@
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
-