curses 1.3.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +19 -0
- data/.github/workflows/ubuntu.yml +26 -0
- data/.github/workflows/windows.yml +25 -0
- data/History.md +27 -0
- data/README.md +14 -46
- data/Rakefile +0 -86
- data/curses.gemspec +3 -4
- data/ext/curses/curses.c +194 -38
- data/ext/curses/extconf.rb +81 -22
- data/lib/curses.rb +5 -12
- data/sample/addch.rb +16 -0
- data/sample/attr_demo.rb +32 -0
- data/sample/colors.rb +26 -0
- data/sample/mouse_move.rb +75 -0
- data/vendor/PDCurses/.gitignore +47 -0
- data/vendor/PDCurses/.travis.yml +49 -0
- data/vendor/PDCurses/CMakeLists.txt +68 -0
- data/vendor/PDCurses/HISTORY.md +2036 -0
- data/vendor/PDCurses/IMPLEMNT.md +327 -0
- data/vendor/PDCurses/Makefile +27 -0
- data/vendor/PDCurses/README.md +77 -0
- data/vendor/PDCurses/acs_defs.h +265 -0
- data/vendor/PDCurses/appveyor.yml +218 -0
- data/vendor/PDCurses/cmake/README.md +71 -0
- data/vendor/PDCurses/cmake/build_dependencies.cmake +178 -0
- data/vendor/PDCurses/cmake/build_options.cmake +25 -0
- data/vendor/PDCurses/cmake/dll_version.cmake +26 -0
- data/vendor/PDCurses/cmake/gen_config_header.cmake +43 -0
- data/vendor/PDCurses/cmake/get_version.cmake +17 -0
- data/vendor/PDCurses/cmake/make_uninstall.cmake +19 -0
- data/vendor/PDCurses/cmake/project_common.cmake +121 -0
- data/vendor/PDCurses/cmake/resource.in.cmake +52 -0
- data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +83 -0
- data/vendor/PDCurses/cmake/target_arch.cmake +36 -0
- data/vendor/PDCurses/cmake/version.in.cmake +73 -0
- data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +96 -0
- data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +106 -0
- data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +105 -0
- data/vendor/PDCurses/curses.h +1846 -0
- data/vendor/PDCurses/curspriv.h +134 -0
- data/vendor/PDCurses/demos/README.md +25 -0
- data/vendor/PDCurses/demos/firework.c +144 -0
- data/vendor/PDCurses/demos/newtest.c +581 -0
- data/vendor/PDCurses/demos/ozdemo.c +447 -0
- data/vendor/PDCurses/demos/ptest.c +283 -0
- data/vendor/PDCurses/demos/rain.c +157 -0
- data/vendor/PDCurses/demos/testcurs.c +1607 -0
- data/vendor/PDCurses/demos/tui.c +1048 -0
- data/vendor/PDCurses/demos/tui.h +65 -0
- data/vendor/PDCurses/demos/tuidemo.c +233 -0
- data/vendor/PDCurses/demos/version.c +61 -0
- data/vendor/PDCurses/demos/worm.c +432 -0
- data/vendor/PDCurses/demos/xmas.c +955 -0
- data/vendor/PDCurses/dos/CMakeLists.txt +47 -0
- data/vendor/PDCurses/dos/Makefile +105 -0
- data/vendor/PDCurses/dos/Makefile.bcc +83 -0
- data/vendor/PDCurses/dos/Makefile.dmc +257 -0
- data/vendor/PDCurses/dos/Makefile.msc +113 -0
- data/vendor/PDCurses/dos/Makefile.wcc +107 -0
- data/vendor/PDCurses/dos/README.md +51 -0
- data/vendor/PDCurses/dos/bccdos.lrf +9 -0
- data/vendor/PDCurses/dos/mscdos.lrf +50 -0
- data/vendor/PDCurses/dos/pdcclip.c +132 -0
- data/vendor/PDCurses/dos/pdcdisp.c +135 -0
- data/vendor/PDCurses/dos/pdcdos.h +194 -0
- data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
- data/vendor/PDCurses/dos/pdckbd.c +513 -0
- data/vendor/PDCurses/dos/pdcscrn.c +785 -0
- data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
- data/vendor/PDCurses/dos/pdcutil.c +212 -0
- data/vendor/PDCurses/libobjs.mif +26 -0
- data/vendor/PDCurses/makedist.mif +20 -0
- data/vendor/PDCurses/man/Makefile +37 -0
- data/vendor/PDCurses/man/README.md +21 -0
- data/vendor/PDCurses/man/intro.md +361 -0
- data/vendor/PDCurses/man/manext.c +119 -0
- data/vendor/PDCurses/man/sdl.md +152 -0
- data/vendor/PDCurses/man/sdl2.md +58 -0
- data/vendor/PDCurses/man/x11.md +407 -0
- data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
- data/vendor/PDCurses/ncurses/README.md +26 -0
- data/vendor/PDCurses/ncurses/makefile +29 -0
- data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
- data/vendor/PDCurses/os2/Makefile +132 -0
- data/vendor/PDCurses/os2/Makefile.bcc +90 -0
- data/vendor/PDCurses/os2/Makefile.wcc +43 -0
- data/vendor/PDCurses/os2/README.md +43 -0
- data/vendor/PDCurses/os2/iccos2.lrf +50 -0
- data/vendor/PDCurses/os2/iccos2.mak +256 -0
- data/vendor/PDCurses/os2/pdcclip.c +188 -0
- data/vendor/PDCurses/os2/pdcdisp.c +93 -0
- data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
- data/vendor/PDCurses/os2/pdckbd.c +521 -0
- data/vendor/PDCurses/os2/pdcos2.h +55 -0
- data/vendor/PDCurses/os2/pdcscrn.c +449 -0
- data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
- data/vendor/PDCurses/os2/pdcutil.c +52 -0
- data/vendor/PDCurses/panel.h +56 -0
- data/vendor/PDCurses/pdcurses/README.md +25 -0
- data/vendor/PDCurses/pdcurses/addch.c +693 -0
- data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
- data/vendor/PDCurses/pdcurses/addstr.c +240 -0
- data/vendor/PDCurses/pdcurses/attr.c +359 -0
- data/vendor/PDCurses/pdcurses/beep.c +68 -0
- data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
- data/vendor/PDCurses/pdcurses/border.c +411 -0
- data/vendor/PDCurses/pdcurses/clear.c +159 -0
- data/vendor/PDCurses/pdcurses/color.c +298 -0
- data/vendor/PDCurses/pdcurses/debug.c +109 -0
- data/vendor/PDCurses/pdcurses/delch.c +96 -0
- data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
- data/vendor/PDCurses/pdcurses/deprec.c +27 -0
- data/vendor/PDCurses/pdcurses/getch.c +417 -0
- data/vendor/PDCurses/pdcurses/getstr.c +474 -0
- data/vendor/PDCurses/pdcurses/getyx.c +139 -0
- data/vendor/PDCurses/pdcurses/inch.c +127 -0
- data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
- data/vendor/PDCurses/pdcurses/initscr.c +367 -0
- data/vendor/PDCurses/pdcurses/inopts.c +324 -0
- data/vendor/PDCurses/pdcurses/insch.c +271 -0
- data/vendor/PDCurses/pdcurses/insstr.c +264 -0
- data/vendor/PDCurses/pdcurses/instr.c +246 -0
- data/vendor/PDCurses/pdcurses/kernel.c +259 -0
- data/vendor/PDCurses/pdcurses/keyname.c +157 -0
- data/vendor/PDCurses/pdcurses/mouse.c +438 -0
- data/vendor/PDCurses/pdcurses/move.c +57 -0
- data/vendor/PDCurses/pdcurses/outopts.c +159 -0
- data/vendor/PDCurses/pdcurses/overlay.c +214 -0
- data/vendor/PDCurses/pdcurses/pad.c +260 -0
- data/vendor/PDCurses/pdcurses/panel.c +633 -0
- data/vendor/PDCurses/pdcurses/printw.c +126 -0
- data/vendor/PDCurses/pdcurses/refresh.c +279 -0
- data/vendor/PDCurses/pdcurses/scanw.c +578 -0
- data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
- data/vendor/PDCurses/pdcurses/scroll.c +101 -0
- data/vendor/PDCurses/pdcurses/slk.c +591 -0
- data/vendor/PDCurses/pdcurses/termattr.c +182 -0
- data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
- data/vendor/PDCurses/pdcurses/touch.c +163 -0
- data/vendor/PDCurses/pdcurses/util.c +312 -0
- data/vendor/PDCurses/pdcurses/window.c +569 -0
- data/vendor/PDCurses/sdl1/Makefile +129 -0
- data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
- data/vendor/PDCurses/sdl1/README.md +31 -0
- data/vendor/PDCurses/sdl1/deffont.h +385 -0
- data/vendor/PDCurses/sdl1/deficon.h +23 -0
- data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
- data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
- data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
- data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
- data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
- data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
- data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
- data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
- data/vendor/PDCurses/sdl1/sdltest.c +79 -0
- data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
- data/vendor/PDCurses/sdl2/Makefile +135 -0
- data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
- data/vendor/PDCurses/sdl2/README.md +34 -0
- data/vendor/PDCurses/sdl2/deffont.h +385 -0
- data/vendor/PDCurses/sdl2/deficon.h +23 -0
- data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
- data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
- data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
- data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
- data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
- data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
- data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
- data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
- data/vendor/PDCurses/sdl2/sdltest.c +81 -0
- data/vendor/PDCurses/term.h +48 -0
- data/vendor/PDCurses/version.mif +7 -0
- data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
- data/vendor/PDCurses/vt/Makefile +135 -0
- data/vendor/PDCurses/vt/Makefile.bcc +111 -0
- data/vendor/PDCurses/vt/Makefile.dmc +258 -0
- data/vendor/PDCurses/vt/Makefile.vc +144 -0
- data/vendor/PDCurses/vt/Makefile.wcc +107 -0
- data/vendor/PDCurses/vt/README.md +64 -0
- data/vendor/PDCurses/vt/pdcclip.c +20 -0
- data/vendor/PDCurses/vt/pdcdisp.c +284 -0
- data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
- data/vendor/PDCurses/vt/pdckbd.c +394 -0
- data/vendor/PDCurses/vt/pdcscrn.c +434 -0
- data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
- data/vendor/PDCurses/vt/pdcutil.c +43 -0
- data/vendor/PDCurses/vt/pdcvt.h +16 -0
- data/vendor/PDCurses/watcom.mif +68 -0
- data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
- data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
- data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
- data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
- data/vendor/PDCurses/wincon/Makefile.mng +176 -0
- data/vendor/PDCurses/wincon/Makefile.vc +144 -0
- data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
- data/vendor/PDCurses/wincon/README.md +85 -0
- data/vendor/PDCurses/wincon/pdcclip.c +174 -0
- data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
- data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
- data/vendor/PDCurses/wincon/pdckbd.c +786 -0
- data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
- data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
- data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
- data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
- data/vendor/PDCurses/wincon/pdcutil.c +41 -0
- data/vendor/PDCurses/wincon/pdcwin.h +31 -0
- data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
- data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
- data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
- data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
- data/vendor/PDCurses/wingui/Makefile.mng +171 -0
- data/vendor/PDCurses/wingui/Makefile.vc +144 -0
- data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
- data/vendor/PDCurses/wingui/README.md +93 -0
- data/vendor/PDCurses/wingui/pdcclip.c +174 -0
- data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
- data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
- data/vendor/PDCurses/wingui/pdckbd.c +143 -0
- data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
- data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
- data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
- data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
- data/vendor/PDCurses/wingui/pdcutil.c +61 -0
- data/vendor/PDCurses/wingui/pdcwin.h +122 -0
- data/vendor/PDCurses/x11/Makefile.in +754 -0
- data/vendor/PDCurses/x11/PDCurses.spec +82 -0
- data/vendor/PDCurses/x11/README.md +62 -0
- data/vendor/PDCurses/x11/ScrollBox.c +319 -0
- data/vendor/PDCurses/x11/ScrollBox.h +51 -0
- data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
- data/vendor/PDCurses/x11/aclocal.m4 +994 -0
- data/vendor/PDCurses/x11/big_icon.xbm +46 -0
- data/vendor/PDCurses/x11/compose.h +201 -0
- data/vendor/PDCurses/x11/config.guess +1500 -0
- data/vendor/PDCurses/x11/config.h.in +100 -0
- data/vendor/PDCurses/x11/config.sub +1616 -0
- data/vendor/PDCurses/x11/configure +6700 -0
- data/vendor/PDCurses/x11/configure.ac +295 -0
- data/vendor/PDCurses/x11/debian/changelog +6 -0
- data/vendor/PDCurses/x11/debian/compat +1 -0
- data/vendor/PDCurses/x11/debian/control +11 -0
- data/vendor/PDCurses/x11/debian/copyright +27 -0
- data/vendor/PDCurses/x11/debian/rules +98 -0
- data/vendor/PDCurses/x11/install-sh +253 -0
- data/vendor/PDCurses/x11/little_icon.xbm +14 -0
- data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
- data/vendor/PDCurses/x11/pdcclip.c +173 -0
- data/vendor/PDCurses/x11/pdcdisp.c +85 -0
- data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
- data/vendor/PDCurses/x11/pdckbd.c +104 -0
- data/vendor/PDCurses/x11/pdcscrn.c +258 -0
- data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
- data/vendor/PDCurses/x11/pdcutil.c +52 -0
- data/vendor/PDCurses/x11/pdcx11.c +316 -0
- data/vendor/PDCurses/x11/pdcx11.h +191 -0
- data/vendor/PDCurses/x11/sb.c +155 -0
- data/vendor/PDCurses/x11/x11.c +3686 -0
- data/vendor/PDCurses/x11/xcurses-config.in +81 -0
- metadata +259 -25
- data/.travis.yml +0 -16
- data/appveyor.yml +0 -16
@@ -0,0 +1,405 @@
|
|
1
|
+
/* Public Domain Curses */
|
2
|
+
|
3
|
+
#include "pdcsdl.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
|
+
#include <string.h>
|
26
|
+
|
27
|
+
unsigned long pdc_key_modifiers = 0L;
|
28
|
+
|
29
|
+
static SDL_Event event;
|
30
|
+
static SDLKey oldkey;
|
31
|
+
static MOUSE_STATUS old_mouse_status;
|
32
|
+
|
33
|
+
static struct
|
34
|
+
{
|
35
|
+
SDLKey keycode;
|
36
|
+
bool numkeypad;
|
37
|
+
unsigned short normal;
|
38
|
+
unsigned short shifted;
|
39
|
+
unsigned short control;
|
40
|
+
unsigned short alt;
|
41
|
+
} key_table[] =
|
42
|
+
{
|
43
|
+
/* keycode keypad normal shifted control alt*/
|
44
|
+
{SDLK_LEFT, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT},
|
45
|
+
{SDLK_RIGHT, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT},
|
46
|
+
{SDLK_UP, FALSE, KEY_UP, KEY_SUP, CTL_UP, ALT_UP},
|
47
|
+
{SDLK_DOWN, FALSE, KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN},
|
48
|
+
{SDLK_HOME, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME},
|
49
|
+
{SDLK_END, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END},
|
50
|
+
{SDLK_PAGEUP, FALSE, KEY_PPAGE, KEY_SPREVIOUS,CTL_PGUP, ALT_PGUP},
|
51
|
+
{SDLK_PAGEDOWN,FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN},
|
52
|
+
{SDLK_INSERT, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS},
|
53
|
+
{SDLK_DELETE, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL},
|
54
|
+
{SDLK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)},
|
55
|
+
{SDLK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)},
|
56
|
+
{SDLK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)},
|
57
|
+
{SDLK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)},
|
58
|
+
{SDLK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)},
|
59
|
+
{SDLK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)},
|
60
|
+
{SDLK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)},
|
61
|
+
{SDLK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)},
|
62
|
+
{SDLK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)},
|
63
|
+
{SDLK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)},
|
64
|
+
{SDLK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)},
|
65
|
+
{SDLK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)},
|
66
|
+
{SDLK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)},
|
67
|
+
{SDLK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)},
|
68
|
+
{SDLK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)},
|
69
|
+
{SDLK_BACKSPACE,FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP},
|
70
|
+
{SDLK_TAB, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB},
|
71
|
+
{SDLK_PRINT, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT},
|
72
|
+
{SDLK_PAUSE, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND},
|
73
|
+
{SDLK_CLEAR, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR},
|
74
|
+
{SDLK_BREAK, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK},
|
75
|
+
{SDLK_HELP, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP},
|
76
|
+
{SDLK_MENU, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS},
|
77
|
+
{SDLK_ESCAPE, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC},
|
78
|
+
{SDLK_KP_ENTER,TRUE, PADENTER, PADENTER, CTL_PADENTER,ALT_PADENTER},
|
79
|
+
{SDLK_KP_PLUS, TRUE, PADPLUS, '+', CTL_PADPLUS, ALT_PADPLUS},
|
80
|
+
{SDLK_KP_MINUS,TRUE, PADMINUS, '-', CTL_PADMINUS,ALT_PADMINUS},
|
81
|
+
{SDLK_KP_MULTIPLY,TRUE,PADSTAR, '*', CTL_PADSTAR, ALT_PADSTAR},
|
82
|
+
{SDLK_KP_DIVIDE,TRUE, PADSLASH, '/', CTL_PADSLASH,ALT_PADSLASH},
|
83
|
+
{SDLK_KP_PERIOD,TRUE, PADSTOP, '.', CTL_PADSTOP, ALT_PADSTOP},
|
84
|
+
{SDLK_KP0, TRUE, PAD0, '0', CTL_PAD0, ALT_PAD0},
|
85
|
+
{SDLK_KP1, TRUE, KEY_C1, '1', CTL_PAD1, ALT_PAD1},
|
86
|
+
{SDLK_KP2, TRUE, KEY_C2, '2', CTL_PAD2, ALT_PAD2},
|
87
|
+
{SDLK_KP3, TRUE, KEY_C3, '3', CTL_PAD3, ALT_PAD3},
|
88
|
+
{SDLK_KP4, TRUE, KEY_B1, '4', CTL_PAD4, ALT_PAD4},
|
89
|
+
{SDLK_KP5, TRUE, KEY_B2, '5', CTL_PAD5, ALT_PAD5},
|
90
|
+
{SDLK_KP6, TRUE, KEY_B3, '6', CTL_PAD6, ALT_PAD6},
|
91
|
+
{SDLK_KP7, TRUE, KEY_A1, '7', CTL_PAD7, ALT_PAD7},
|
92
|
+
{SDLK_KP8, TRUE, KEY_A2, '8', CTL_PAD8, ALT_PAD8},
|
93
|
+
{SDLK_KP9, TRUE, KEY_A3, '9', CTL_PAD9, ALT_PAD9},
|
94
|
+
{0, 0, 0, 0, 0, 0}
|
95
|
+
};
|
96
|
+
|
97
|
+
unsigned long PDC_get_input_fd(void)
|
98
|
+
{
|
99
|
+
PDC_LOG(("PDC_get_input_fd() - called\n"));
|
100
|
+
|
101
|
+
return 0L; /* test this */
|
102
|
+
}
|
103
|
+
|
104
|
+
void PDC_set_keyboard_binary(bool on)
|
105
|
+
{
|
106
|
+
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
|
107
|
+
}
|
108
|
+
|
109
|
+
/* check if a key or mouse event is waiting */
|
110
|
+
|
111
|
+
bool PDC_check_key(void)
|
112
|
+
{
|
113
|
+
Uint32 current = SDL_GetTicks();
|
114
|
+
int haveevent = SDL_PollEvent(&event);
|
115
|
+
|
116
|
+
/* if we have an event, or 30 ms have passed without a screen
|
117
|
+
update, or the timer has wrapped, update now */
|
118
|
+
|
119
|
+
if (haveevent ||
|
120
|
+
current < pdc_lastupdate || ((current - pdc_lastupdate) > 30))
|
121
|
+
PDC_update_rects();
|
122
|
+
|
123
|
+
return haveevent;
|
124
|
+
}
|
125
|
+
|
126
|
+
static int _process_key_event(void)
|
127
|
+
{
|
128
|
+
int i, key = 0;
|
129
|
+
|
130
|
+
pdc_key_modifiers = 0L;
|
131
|
+
SP->key_code = FALSE;
|
132
|
+
|
133
|
+
if (event.type == SDL_KEYUP)
|
134
|
+
{
|
135
|
+
if (SP->return_key_modifiers && event.key.keysym.sym == oldkey)
|
136
|
+
{
|
137
|
+
switch (oldkey)
|
138
|
+
{
|
139
|
+
case SDLK_RSHIFT:
|
140
|
+
return KEY_SHIFT_R;
|
141
|
+
case SDLK_LSHIFT:
|
142
|
+
return KEY_SHIFT_L;
|
143
|
+
case SDLK_RCTRL:
|
144
|
+
return KEY_CONTROL_R;
|
145
|
+
case SDLK_LCTRL:
|
146
|
+
return KEY_CONTROL_L;
|
147
|
+
case SDLK_RALT:
|
148
|
+
return KEY_ALT_R;
|
149
|
+
case SDLK_LALT:
|
150
|
+
return KEY_ALT_L;
|
151
|
+
default:
|
152
|
+
break;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
return -1;
|
157
|
+
}
|
158
|
+
|
159
|
+
oldkey = event.key.keysym.sym;
|
160
|
+
|
161
|
+
if (SP->save_key_modifiers)
|
162
|
+
{
|
163
|
+
if (event.key.keysym.mod & KMOD_NUM)
|
164
|
+
pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
|
165
|
+
|
166
|
+
if (event.key.keysym.mod & KMOD_SHIFT)
|
167
|
+
pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
|
168
|
+
|
169
|
+
if (event.key.keysym.mod & KMOD_CTRL)
|
170
|
+
pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
|
171
|
+
|
172
|
+
if (event.key.keysym.mod & KMOD_ALT)
|
173
|
+
pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
|
174
|
+
}
|
175
|
+
|
176
|
+
for (i = 0; key_table[i].keycode; i++)
|
177
|
+
{
|
178
|
+
if (key_table[i].keycode == event.key.keysym.sym)
|
179
|
+
{
|
180
|
+
if ((event.key.keysym.mod & KMOD_SHIFT) ||
|
181
|
+
(key_table[i].numkeypad && (event.key.keysym.mod & KMOD_NUM)))
|
182
|
+
{
|
183
|
+
key = key_table[i].shifted;
|
184
|
+
}
|
185
|
+
else if (event.key.keysym.mod & KMOD_CTRL)
|
186
|
+
{
|
187
|
+
key = key_table[i].control;
|
188
|
+
}
|
189
|
+
else if (event.key.keysym.mod & KMOD_ALT)
|
190
|
+
{
|
191
|
+
key = key_table[i].alt;
|
192
|
+
}
|
193
|
+
|
194
|
+
/* To get here, we ignore all other modifiers */
|
195
|
+
|
196
|
+
else
|
197
|
+
key = key_table[i].normal;
|
198
|
+
|
199
|
+
SP->key_code = (key > 0x100);
|
200
|
+
break;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
if (!key)
|
205
|
+
{
|
206
|
+
key = event.key.keysym.unicode;
|
207
|
+
|
208
|
+
if (key > 0x7f)
|
209
|
+
key = 0;
|
210
|
+
}
|
211
|
+
|
212
|
+
/* Handle ALT letters and numbers */
|
213
|
+
|
214
|
+
if (event.key.keysym.mod & KMOD_ALT)
|
215
|
+
{
|
216
|
+
if (key >= 'A' && key <= 'Z')
|
217
|
+
{
|
218
|
+
key += ALT_A - 'A';
|
219
|
+
SP->key_code = TRUE;
|
220
|
+
}
|
221
|
+
|
222
|
+
if (key >= 'a' && key <= 'z')
|
223
|
+
{
|
224
|
+
key += ALT_A - 'a';
|
225
|
+
SP->key_code = TRUE;
|
226
|
+
}
|
227
|
+
|
228
|
+
if (key >= '0' && key <= '9')
|
229
|
+
{
|
230
|
+
key += ALT_0 - '0';
|
231
|
+
SP->key_code = TRUE;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
return key ? key : -1;
|
236
|
+
}
|
237
|
+
|
238
|
+
static int _process_mouse_event(void)
|
239
|
+
{
|
240
|
+
SDLMod keymods;
|
241
|
+
short shift_flags = 0;
|
242
|
+
|
243
|
+
memset(&pdc_mouse_status, 0, sizeof(MOUSE_STATUS));
|
244
|
+
|
245
|
+
keymods = SDL_GetModState();
|
246
|
+
|
247
|
+
if (keymods & KMOD_SHIFT)
|
248
|
+
shift_flags |= BUTTON_SHIFT;
|
249
|
+
|
250
|
+
if (keymods & KMOD_CTRL)
|
251
|
+
shift_flags |= BUTTON_CONTROL;
|
252
|
+
|
253
|
+
if (keymods & KMOD_ALT)
|
254
|
+
shift_flags |= BUTTON_ALT;
|
255
|
+
|
256
|
+
if (event.type == SDL_MOUSEMOTION)
|
257
|
+
{
|
258
|
+
int i;
|
259
|
+
|
260
|
+
pdc_mouse_status.x = event.motion.x / pdc_fwidth;
|
261
|
+
pdc_mouse_status.y = event.motion.y / pdc_fheight;
|
262
|
+
|
263
|
+
if (!event.motion.state ||
|
264
|
+
(pdc_mouse_status.x == old_mouse_status.x &&
|
265
|
+
pdc_mouse_status.y == old_mouse_status.y))
|
266
|
+
return -1;
|
267
|
+
|
268
|
+
pdc_mouse_status.changes = PDC_MOUSE_MOVED;
|
269
|
+
|
270
|
+
for (i = 0; i < 3; i++)
|
271
|
+
{
|
272
|
+
if (event.motion.state & SDL_BUTTON(i + 1))
|
273
|
+
{
|
274
|
+
pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags;
|
275
|
+
pdc_mouse_status.changes |= (1 << i);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
else
|
280
|
+
{
|
281
|
+
short action = (event.button.state == SDL_PRESSED) ?
|
282
|
+
BUTTON_PRESSED : BUTTON_RELEASED;
|
283
|
+
Uint8 btn = event.button.button;
|
284
|
+
|
285
|
+
/* handle scroll wheel */
|
286
|
+
|
287
|
+
if ((btn >= 4 && btn <= 7) && action == BUTTON_RELEASED)
|
288
|
+
{
|
289
|
+
pdc_mouse_status.x = pdc_mouse_status.y = -1;
|
290
|
+
|
291
|
+
switch (btn)
|
292
|
+
{
|
293
|
+
case 4:
|
294
|
+
pdc_mouse_status.changes = PDC_MOUSE_WHEEL_UP;
|
295
|
+
break;
|
296
|
+
case 5:
|
297
|
+
pdc_mouse_status.changes = PDC_MOUSE_WHEEL_DOWN;
|
298
|
+
break;
|
299
|
+
case 6:
|
300
|
+
pdc_mouse_status.changes = PDC_MOUSE_WHEEL_LEFT;
|
301
|
+
break;
|
302
|
+
case 7:
|
303
|
+
pdc_mouse_status.changes = PDC_MOUSE_WHEEL_RIGHT;
|
304
|
+
}
|
305
|
+
|
306
|
+
SP->key_code = TRUE;
|
307
|
+
return KEY_MOUSE;
|
308
|
+
}
|
309
|
+
|
310
|
+
if (btn < 1 || btn > 3)
|
311
|
+
return -1;
|
312
|
+
|
313
|
+
/* check for a click -- a press followed immediately by a release */
|
314
|
+
|
315
|
+
if (action == BUTTON_PRESSED && SP->mouse_wait)
|
316
|
+
{
|
317
|
+
SDL_Event rel;
|
318
|
+
|
319
|
+
napms(SP->mouse_wait);
|
320
|
+
|
321
|
+
if (SDL_PollEvent(&rel))
|
322
|
+
{
|
323
|
+
if (rel.type == SDL_MOUSEBUTTONUP && rel.button.button == btn)
|
324
|
+
action = BUTTON_CLICKED;
|
325
|
+
else
|
326
|
+
SDL_PushEvent(&rel);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
pdc_mouse_status.x = event.button.x / pdc_fwidth;
|
331
|
+
pdc_mouse_status.y = event.button.y / pdc_fheight;
|
332
|
+
|
333
|
+
btn--;
|
334
|
+
|
335
|
+
pdc_mouse_status.button[btn] = action | shift_flags;
|
336
|
+
pdc_mouse_status.changes = (1 << btn);
|
337
|
+
}
|
338
|
+
|
339
|
+
old_mouse_status = pdc_mouse_status;
|
340
|
+
|
341
|
+
SP->key_code = TRUE;
|
342
|
+
return KEY_MOUSE;
|
343
|
+
}
|
344
|
+
|
345
|
+
/* return the next available key or mouse event */
|
346
|
+
|
347
|
+
int PDC_get_key(void)
|
348
|
+
{
|
349
|
+
switch (event.type)
|
350
|
+
{
|
351
|
+
case SDL_QUIT:
|
352
|
+
exit(1);
|
353
|
+
case SDL_VIDEORESIZE:
|
354
|
+
if (pdc_own_screen &&
|
355
|
+
(event.resize.h / pdc_fheight != LINES ||
|
356
|
+
event.resize.w / pdc_fwidth != COLS))
|
357
|
+
{
|
358
|
+
pdc_sheight = event.resize.h;
|
359
|
+
pdc_swidth = event.resize.w;
|
360
|
+
|
361
|
+
if (!SP->resized)
|
362
|
+
{
|
363
|
+
SP->resized = TRUE;
|
364
|
+
return KEY_RESIZE;
|
365
|
+
}
|
366
|
+
}
|
367
|
+
break;
|
368
|
+
case SDL_MOUSEMOTION:
|
369
|
+
SDL_ShowCursor(SDL_ENABLE);
|
370
|
+
case SDL_MOUSEBUTTONUP:
|
371
|
+
case SDL_MOUSEBUTTONDOWN:
|
372
|
+
oldkey = SDLK_SPACE;
|
373
|
+
if (SP->_trap_mbe)
|
374
|
+
return _process_mouse_event();
|
375
|
+
break;
|
376
|
+
case SDL_KEYUP:
|
377
|
+
case SDL_KEYDOWN:
|
378
|
+
PDC_mouse_set();
|
379
|
+
return _process_key_event();
|
380
|
+
}
|
381
|
+
|
382
|
+
return -1;
|
383
|
+
}
|
384
|
+
|
385
|
+
/* discard any pending keyboard or mouse input -- this is the core
|
386
|
+
routine for flushinp() */
|
387
|
+
|
388
|
+
void PDC_flushinp(void)
|
389
|
+
{
|
390
|
+
PDC_LOG(("PDC_flushinp() - called\n"));
|
391
|
+
|
392
|
+
while (PDC_check_key());
|
393
|
+
}
|
394
|
+
|
395
|
+
int PDC_mouse_set(void)
|
396
|
+
{
|
397
|
+
SDL_ShowCursor(SP->_trap_mbe ? SDL_ENABLE : SDL_DISABLE);
|
398
|
+
|
399
|
+
return OK;
|
400
|
+
}
|
401
|
+
|
402
|
+
int PDC_modifiers_set(void)
|
403
|
+
{
|
404
|
+
return OK;
|
405
|
+
}
|