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,438 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include <curspriv.h>
4
-
5
- /*man-start**************************************************************
6
-
7
- mouse
8
- -----
9
-
10
- ### Synopsis
11
-
12
- int mouse_set(unsigned long mbe);
13
- int mouse_on(unsigned long mbe);
14
- int mouse_off(unsigned long mbe);
15
- int request_mouse_pos(void);
16
- int map_button(unsigned long button);
17
- void wmouse_position(WINDOW *win, int *y, int *x);
18
- unsigned long getmouse(void);
19
- unsigned long getbmap(void);
20
-
21
- int mouseinterval(int wait);
22
- bool wenclose(const WINDOW *win, int y, int x);
23
- bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen);
24
- bool mouse_trafo(int *y, int *x, bool to_screen);
25
- mmask_t mousemask(mmask_t mask, mmask_t *oldmask);
26
- int nc_getmouse(MEVENT *event);
27
- int ungetmouse(MEVENT *event);
28
-
29
- ### Description
30
-
31
- As of PDCurses 3.0, there are two separate mouse interfaces: the
32
- classic interface, which is based on the undocumented Sys V
33
- mouse functions; and an ncurses-compatible interface. Both are
34
- active at all times, and you can mix and match functions from
35
- each, though it's not recommended. The ncurses interface is
36
- essentially an emulation layer built on top of the classic
37
- interface; it's here to allow easier porting of ncurses apps.
38
-
39
- The classic interface: mouse_set(), mouse_on(), mouse_off(),
40
- request_mouse_pos(), map_button(), wmouse_position(),
41
- getmouse(), and getbmap(). An application using this interface
42
- would start by calling mouse_set() or mouse_on() with a non-zero
43
- value, often ALL_MOUSE_EVENTS. Then it would check for a
44
- KEY_MOUSE return from getch(). If found, it would call
45
- request_mouse_pos() to get the current mouse status.
46
-
47
- mouse_set(), mouse_on() and mouse_off() are analagous to
48
- attrset(), attron() and attroff(). These functions set the
49
- mouse button events to trap. The button masks used in these
50
- functions are defined in curses.h and can be or'ed together.
51
- They are the group of masks starting with BUTTON1_RELEASED.
52
-
53
- request_mouse_pos() requests curses to fill in the Mouse_status
54
- structure with the current state of the mouse.
55
-
56
- map_button() enables the specified mouse action to activate the
57
- Soft Label Keys if the action occurs over the area of the screen
58
- where the Soft Label Keys are displayed. The mouse actions are
59
- defined in curses.h in the group that starts with BUTTON_RELEASED.
60
-
61
- wmouse_position() determines if the current mouse position is
62
- within the window passed as an argument. If the mouse is
63
- outside the current window, -1 is returned in the y and x
64
- arguments; otherwise the y and x coordinates of the mouse
65
- (relative to the top left corner of the window) are returned in
66
- y and x.
67
-
68
- getmouse() returns the current status of the trapped mouse
69
- buttons as set by mouse_set() or mouse_on().
70
-
71
- getbmap() returns the current status of the button action used
72
- to map a mouse action to the Soft Label Keys as set by the
73
- map_button() function.
74
-
75
- The ncurses interface: mouseinterval(), wenclose(),
76
- wmouse_trafo(), mouse_trafo(), mousemask(), nc_getmouse(), and
77
- ungetmouse(). A typical application using this interface would
78
- start by calling mousemask() with a non-zero value, often
79
- ALL_MOUSE_EVENTS. Then it would check for a KEY_MOUSE return
80
- from getch(). If found, it would call nc_getmouse() to get the
81
- current mouse status.
82
-
83
- mouseinterval() sets the timeout for a mouse click. On all
84
- current platforms, PDCurses receives mouse button press and
85
- release events, but must synthesize click events. It does this
86
- by checking whether a release event is queued up after a press
87
- event. If it gets a press event, and there are no more events
88
- waiting, it will wait for the timeout interval, then check again
89
- for a release. A press followed by a release is reported as
90
- BUTTON_CLICKED; otherwise it's passed through as BUTTON_PRESSED.
91
- The default timeout is 150ms; valid values are 0 (no clicks
92
- reported) through 1000ms. In x11, the timeout can also be set
93
- via the clickPeriod resource. The return value from
94
- mouseinterval() is the old timeout. To check the old value
95
- without setting a new one, call it with a parameter of -1. Note
96
- that although there's no classic equivalent for this function
97
- (apart from the clickPeriod resource), the value set applies in
98
- both interfaces.
99
-
100
- wenclose() reports whether the given screen-relative y, x
101
- coordinates fall within the given window.
102
-
103
- wmouse_trafo() converts between screen-relative and window-
104
- relative coordinates. A to_screen parameter of TRUE means to
105
- convert from window to screen; otherwise the reverse. The
106
- function returns FALSE if the coordinates aren't within the
107
- window, or if any of the parameters are NULL. The coordinates
108
- have been converted when the function returns TRUE.
109
-
110
- mouse_trafo() is the stdscr version of wmouse_trafo().
111
-
112
- mousemask() is nearly equivalent to mouse_set(), but instead of
113
- OK/ERR, it returns the value of the mask after setting it. (This
114
- isn't necessarily the same value passed in, since the mask could
115
- be altered on some platforms.) And if the second parameter is a
116
- non-null pointer, mousemask() stores the previous mask value
117
- there. Also, since the ncurses interface doesn't work with
118
- PDCurses' BUTTON_MOVED events, mousemask() filters them out.
119
-
120
- nc_getmouse() returns the current mouse status in an MEVENT
121
- struct. This is equivalent to ncurses' getmouse(), renamed to
122
- avoid conflict with PDCurses' getmouse(). But if you define
123
- PDC_NCMOUSE before including curses.h, it defines getmouse() to
124
- nc_getmouse(), along with a few other redefintions needed for
125
- compatibility with ncurses code. nc_getmouse() calls
126
- request_mouse_pos(), which (not getmouse()) is the classic
127
- equivalent.
128
-
129
- ungetmouse() is the mouse equivalent of ungetch(). However,
130
- PDCurses doesn't maintain a queue of mouse events; only one can
131
- be pushed back, and it can overwrite or be overwritten by real
132
- mouse events.
133
-
134
- ### Portability
135
- X/Open BSD SYS V
136
- mouse_set - - 4.0
137
- mouse_on - - 4.0
138
- mouse_off - - 4.0
139
- request_mouse_pos - - 4.0
140
- map_button - - 4.0
141
- wmouse_position - - 4.0
142
- getmouse - - 4.0
143
- getbmap - - 4.0
144
- mouseinterval - - -
145
- wenclose - - -
146
- wmouse_trafo - - -
147
- mouse_trafo - - -
148
- mousemask - - -
149
- nc_getmouse - - -
150
- ungetmouse - - -
151
-
152
- **man-end****************************************************************/
153
-
154
- #include <string.h>
155
-
156
- static bool ungot = FALSE;
157
-
158
- int mouse_set(unsigned long mbe)
159
- {
160
- PDC_LOG(("mouse_set() - called: event %x\n", mbe));
161
-
162
- SP->_trap_mbe = mbe;
163
- return PDC_mouse_set();
164
- }
165
-
166
- int mouse_on(unsigned long mbe)
167
- {
168
- PDC_LOG(("mouse_on() - called: event %x\n", mbe));
169
-
170
- SP->_trap_mbe |= mbe;
171
- return PDC_mouse_set();
172
- }
173
-
174
- int mouse_off(unsigned long mbe)
175
- {
176
- PDC_LOG(("mouse_off() - called: event %x\n", mbe));
177
-
178
- SP->_trap_mbe &= ~mbe;
179
- return PDC_mouse_set();
180
- }
181
-
182
- int map_button(unsigned long button)
183
- {
184
- PDC_LOG(("map_button() - called: button %x\n", button));
185
-
186
- /****************** this does nothing at the moment ***************/
187
- SP->_map_mbe_to_key = button;
188
-
189
- return OK;
190
- }
191
-
192
- int request_mouse_pos(void)
193
- {
194
- PDC_LOG(("request_mouse_pos() - called\n"));
195
-
196
- Mouse_status = pdc_mouse_status;
197
-
198
- return OK;
199
- }
200
-
201
- void wmouse_position(WINDOW *win, int *y, int *x)
202
- {
203
- PDC_LOG(("wmouse_position() - called\n"));
204
-
205
- if (win && wenclose(win, MOUSE_Y_POS, MOUSE_X_POS))
206
- {
207
- if (y)
208
- *y = MOUSE_Y_POS - win->_begy;
209
- if (x)
210
- *x = MOUSE_X_POS - win->_begx;
211
- }
212
- else
213
- {
214
- if (y)
215
- *y = -1;
216
- if (x)
217
- *x = -1;
218
- }
219
- }
220
-
221
- unsigned long getmouse(void)
222
- {
223
- PDC_LOG(("getmouse() - called\n"));
224
-
225
- return SP->_trap_mbe;
226
- }
227
-
228
- unsigned long getbmap(void)
229
- {
230
- PDC_LOG(("getbmap() - called\n"));
231
-
232
- return SP->_map_mbe_to_key;
233
- }
234
-
235
- /* ncurses mouse interface */
236
-
237
- int mouseinterval(int wait)
238
- {
239
- int old_wait;
240
-
241
- PDC_LOG(("mouseinterval() - called: %d\n", wait));
242
-
243
- old_wait = SP->mouse_wait;
244
-
245
- if (wait >= 0 && wait <= 1000)
246
- SP->mouse_wait = wait;
247
-
248
- return old_wait;
249
- }
250
-
251
- bool wenclose(const WINDOW *win, int y, int x)
252
- {
253
- PDC_LOG(("wenclose() - called: %p %d %d\n", win, y, x));
254
-
255
- return (win && y >= win->_begy && y < win->_begy + win->_maxy
256
- && x >= win->_begx && x < win->_begx + win->_maxx);
257
- }
258
-
259
- bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen)
260
- {
261
- int newy, newx;
262
-
263
- PDC_LOG(("wmouse_trafo() - called\n"));
264
-
265
- if (!win || !y || !x)
266
- return FALSE;
267
-
268
- newy = *y;
269
- newx = *x;
270
-
271
- if (to_screen)
272
- {
273
- newy += win->_begy;
274
- newx += win->_begx;
275
-
276
- if (!wenclose(win, newy, newx))
277
- return FALSE;
278
- }
279
- else
280
- {
281
- if (wenclose(win, newy, newx))
282
- {
283
- newy -= win->_begy;
284
- newx -= win->_begx;
285
- }
286
- else
287
- return FALSE;
288
- }
289
-
290
- *y = newy;
291
- *x = newx;
292
-
293
- return TRUE;
294
- }
295
-
296
- bool mouse_trafo(int *y, int *x, bool to_screen)
297
- {
298
- PDC_LOG(("mouse_trafo() - called\n"));
299
-
300
- return wmouse_trafo(stdscr, y, x, to_screen);
301
- }
302
-
303
- mmask_t mousemask(mmask_t mask, mmask_t *oldmask)
304
- {
305
- PDC_LOG(("mousemask() - called\n"));
306
-
307
- if (oldmask)
308
- *oldmask = SP->_trap_mbe;
309
-
310
- /* The ncurses interface doesn't work with our move events, so
311
- filter them here */
312
-
313
- mask &= ~(BUTTON1_MOVED | BUTTON2_MOVED | BUTTON3_MOVED);
314
-
315
- mouse_set(mask);
316
-
317
- return SP->_trap_mbe;
318
- }
319
-
320
- int nc_getmouse(MEVENT *event)
321
- {
322
- int i;
323
- mmask_t bstate = 0;
324
-
325
- PDC_LOG(("nc_getmouse() - called\n"));
326
-
327
- if (!event)
328
- return ERR;
329
-
330
- ungot = FALSE;
331
-
332
- request_mouse_pos();
333
-
334
- event->id = 0;
335
-
336
- event->x = Mouse_status.x;
337
- event->y = Mouse_status.y;
338
- event->z = 0;
339
-
340
- for (i = 0; i < 3; i++)
341
- {
342
- if (Mouse_status.changes & (1 << i))
343
- {
344
- int shf = i * 5;
345
- short button = Mouse_status.button[i] & BUTTON_ACTION_MASK;
346
-
347
- if (button == BUTTON_RELEASED)
348
- bstate |= (BUTTON1_RELEASED << shf);
349
- else if (button == BUTTON_PRESSED)
350
- bstate |= (BUTTON1_PRESSED << shf);
351
- else if (button == BUTTON_CLICKED)
352
- bstate |= (BUTTON1_CLICKED << shf);
353
- else if (button == BUTTON_DOUBLE_CLICKED)
354
- bstate |= (BUTTON1_DOUBLE_CLICKED << shf);
355
- else if (button == BUTTON_TRIPLE_CLICKED)
356
- bstate |= (BUTTON1_TRIPLE_CLICKED << shf);
357
-
358
- button = Mouse_status.button[i] & BUTTON_MODIFIER_MASK;
359
-
360
- if (button & PDC_BUTTON_SHIFT)
361
- bstate |= BUTTON_MODIFIER_SHIFT;
362
- if (button & PDC_BUTTON_CONTROL)
363
- bstate |= BUTTON_MODIFIER_CONTROL;
364
- if (button & PDC_BUTTON_ALT)
365
- bstate |= BUTTON_MODIFIER_ALT;
366
- }
367
- }
368
-
369
- if (MOUSE_WHEEL_UP)
370
- bstate |= BUTTON4_PRESSED;
371
- else if (MOUSE_WHEEL_DOWN)
372
- bstate |= BUTTON5_PRESSED;
373
- if( MOUSE_MOVED)
374
- bstate |= REPORT_MOUSE_POSITION;
375
-
376
- /* extra filter pass -- mainly for button modifiers */
377
-
378
- event->bstate = bstate & SP->_trap_mbe;
379
-
380
- return OK;
381
- }
382
-
383
- int ungetmouse(MEVENT *event)
384
- {
385
- int i;
386
- unsigned long bstate;
387
-
388
- PDC_LOG(("ungetmouse() - called\n"));
389
-
390
- if (!event || ungot)
391
- return ERR;
392
-
393
- ungot = TRUE;
394
-
395
- pdc_mouse_status.x = event->x;
396
- pdc_mouse_status.y = event->y;
397
-
398
- pdc_mouse_status.changes = 0;
399
- bstate = event->bstate;
400
-
401
- for (i = 0; i < 3; i++)
402
- {
403
- int shf = i * 5;
404
- short button = 0;
405
-
406
- if (bstate & ((BUTTON1_RELEASED | BUTTON1_PRESSED |
407
- BUTTON1_TRIPLE_CLICKED |
408
- BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED) << shf))
409
- {
410
- pdc_mouse_status.changes |= 1 << i;
411
-
412
- if (bstate & (BUTTON1_PRESSED << shf))
413
- button = BUTTON_PRESSED;
414
- if (bstate & (BUTTON1_CLICKED << shf))
415
- button = BUTTON_CLICKED;
416
- if (bstate & (BUTTON1_DOUBLE_CLICKED << shf))
417
- button = BUTTON_DOUBLE_CLICKED;
418
- if (bstate & (BUTTON1_TRIPLE_CLICKED << shf))
419
- button = BUTTON_TRIPLE_CLICKED;
420
-
421
- if (bstate & BUTTON_MODIFIER_SHIFT)
422
- button |= PDC_BUTTON_SHIFT;
423
- if (bstate & BUTTON_MODIFIER_CONTROL)
424
- button |= PDC_BUTTON_CONTROL;
425
- if (bstate & BUTTON_MODIFIER_ALT)
426
- button |= PDC_BUTTON_ALT;
427
- }
428
-
429
- pdc_mouse_status.button[i] = button;
430
- }
431
-
432
- if (bstate & BUTTON4_PRESSED)
433
- pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_UP;
434
- else if (bstate & BUTTON5_PRESSED)
435
- pdc_mouse_status.changes |= PDC_MOUSE_WHEEL_DOWN;
436
-
437
- return ungetch(KEY_MOUSE);
438
- }
@@ -1,57 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include <curspriv.h>
4
-
5
- /*man-start**************************************************************
6
-
7
- move
8
- ----
9
-
10
- ### Synopsis
11
-
12
- int move(int y, int x);
13
- int wmove(WINDOW *win, int y, int x);
14
-
15
- ### Description
16
-
17
- The cursor associated with the window is moved to the given
18
- location. This does not move the physical cursor of the
19
- terminal until refresh() is called. The position specified is
20
- relative to the upper left corner of the window, which is (0,0).
21
-
22
- ### Return Value
23
-
24
- All functions return OK on success and ERR on error.
25
-
26
- ### Portability
27
- X/Open BSD SYS V
28
- move Y Y Y
29
- wmove Y Y Y
30
-
31
- **man-end****************************************************************/
32
-
33
- int move(int y, int x)
34
- {
35
- PDC_LOG(("move() - called: y=%d x=%d\n", y, x));
36
-
37
- if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy)
38
- return ERR;
39
-
40
- stdscr->_curx = x;
41
- stdscr->_cury = y;
42
-
43
- return OK;
44
- }
45
-
46
- int wmove(WINDOW *win, int y, int x)
47
- {
48
- PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x));
49
-
50
- if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy)
51
- return ERR;
52
-
53
- win->_curx = x;
54
- win->_cury = y;
55
-
56
- return OK;
57
- }
@@ -1,159 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include <curspriv.h>
4
-
5
- /*man-start**************************************************************
6
-
7
- outopts
8
- -------
9
-
10
- ### Synopsis
11
-
12
- int clearok(WINDOW *win, bool bf);
13
- int idlok(WINDOW *win, bool bf);
14
- void idcok(WINDOW *win, bool bf);
15
- void immedok(WINDOW *win, bool bf);
16
- int leaveok(WINDOW *win, bool bf);
17
- int setscrreg(int top, int bot);
18
- int wsetscrreg(WINDOW *win, int top, int bot);
19
- int scrollok(WINDOW *win, bool bf);
20
-
21
- int raw_output(bool bf);
22
-
23
- ### Description
24
-
25
- With clearok(), if bf is TRUE, the next call to wrefresh() with
26
- this window will clear the screen completely and redraw the
27
- entire screen.
28
-
29
- immedok(), called with a second argument of TRUE, causes an
30
- automatic wrefresh() every time a change is made to the
31
- specified window.
32
-
33
- Normally, the hardware cursor is left at the location of the
34
- window being refreshed. leaveok() allows the cursor to be
35
- left wherever the update happens to leave it. It's useful
36
- for applications where the cursor is not used, since it reduces
37
- the need for cursor motions. If possible, the cursor is made
38
- invisible when this option is enabled.
39
-
40
- wsetscrreg() sets a scrolling region in a window; "top" and
41
- "bot" are the line numbers for the top and bottom margins. If
42
- this option and scrollok() are enabled, any attempt to move off
43
- the bottom margin will cause all lines in the scrolling region
44
- to scroll up one line. setscrreg() is the stdscr version.
45
-
46
- idlok() and idcok() do nothing in PDCurses, but are provided for
47
- compatibility with other curses implementations.
48
-
49
- raw_output() enables the output of raw characters using the
50
- standard *add* and *ins* curses functions (that is, it disables
51
- translation of control characters).
52
-
53
- ### Return Value
54
-
55
- All functions return OK on success and ERR on error.
56
-
57
- ### Portability
58
- X/Open BSD SYS V
59
- clearok Y Y Y
60
- idlok Y Y Y
61
- idcok Y - 4.0
62
- immedok Y - 4.0
63
- leaveok Y Y Y
64
- setscrreg Y Y Y
65
- wsetscrreg Y Y Y
66
- scrollok Y Y Y
67
- raw_output - - -
68
-
69
- **man-end****************************************************************/
70
-
71
- int clearok(WINDOW *win, bool bf)
72
- {
73
- PDC_LOG(("clearok() - called\n"));
74
-
75
- if (!win)
76
- return ERR;
77
-
78
- win->_clear = bf;
79
-
80
- return OK;
81
- }
82
-
83
- int idlok(WINDOW *win, bool bf)
84
- {
85
- PDC_LOG(("idlok() - called\n"));
86
-
87
- return OK;
88
- }
89
-
90
- void idcok(WINDOW *win, bool bf)
91
- {
92
- PDC_LOG(("idcok() - called\n"));
93
- }
94
-
95
- void immedok(WINDOW *win, bool bf)
96
- {
97
- PDC_LOG(("immedok() - called\n"));
98
-
99
- if (win)
100
- win->_immed = bf;
101
- }
102
-
103
- int leaveok(WINDOW *win, bool bf)
104
- {
105
- PDC_LOG(("leaveok() - called\n"));
106
-
107
- if (!win)
108
- return ERR;
109
-
110
- win->_leaveit = bf;
111
-
112
- curs_set(!bf);
113
-
114
- return OK;
115
- }
116
-
117
- int setscrreg(int top, int bottom)
118
- {
119
- PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom));
120
-
121
- return wsetscrreg(stdscr, top, bottom);
122
- }
123
-
124
- int wsetscrreg(WINDOW *win, int top, int bottom)
125
- {
126
- PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom));
127
-
128
- if (win && 0 <= top && top <= win->_cury &&
129
- win->_cury <= bottom && bottom < win->_maxy)
130
- {
131
- win->_tmarg = top;
132
- win->_bmarg = bottom;
133
-
134
- return OK;
135
- }
136
- else
137
- return ERR;
138
- }
139
-
140
- int scrollok(WINDOW *win, bool bf)
141
- {
142
- PDC_LOG(("scrollok() - called\n"));
143
-
144
- if (!win)
145
- return ERR;
146
-
147
- win->_scroll = bf;
148
-
149
- return OK;
150
- }
151
-
152
- int raw_output(bool bf)
153
- {
154
- PDC_LOG(("raw_output() - called\n"));
155
-
156
- SP->raw_out = bf;
157
-
158
- return OK;
159
- }