|
@@ -2,13 +2,23 @@
|
2
|
2
|
#include <stddef.h>
|
3
|
3
|
#include <timer.h>
|
4
|
4
|
#include "core.h"
|
5
|
|
-#include "input.h"
|
6
|
5
|
|
7
|
6
|
/** @file
|
8
|
7
|
*
|
9
|
8
|
* MuCurses keyboard input handling functions
|
10
|
9
|
*/
|
11
|
10
|
|
|
11
|
+#define INPUT_DELAY 200 // half-blocking delay timer resolution (ms)
|
|
12
|
+#define INPUT_DELAY_TIMEOUT 1000 // half-blocking delay timeout
|
|
13
|
+
|
|
14
|
+int m_delay; /*
|
|
15
|
+ < 0 : blocking read
|
|
16
|
+ 0 : non-blocking read
|
|
17
|
+ > 0 : timed blocking read
|
|
18
|
+ */
|
|
19
|
+bool m_echo;
|
|
20
|
+bool m_cbreak;
|
|
21
|
+
|
12
|
22
|
/**
|
13
|
23
|
* Check KEY_ code supported status
|
14
|
24
|
*
|
|
@@ -84,7 +94,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
|
84
|
94
|
|
85
|
95
|
_str = str;
|
86
|
96
|
|
87
|
|
- while ( ( ( c = wgetch( win ) ) != KEY_ENTER ) && !( n == 0 ) ) {
|
|
97
|
+ while ( ( ( c = wgetch( win ) ) != '\n' ) && !( n == 0 ) ) {
|
88
|
98
|
if ( c >= 0401 && c <= 0633 ) {
|
89
|
99
|
switch(c) {
|
90
|
100
|
case KEY_LEFT :
|
|
@@ -105,3 +115,20 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
|
105
|
115
|
|
106
|
116
|
return OK;
|
107
|
117
|
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+/**
|
|
121
|
+ *
|
|
122
|
+ */
|
|
123
|
+int echo ( void ) {
|
|
124
|
+ m_echo = TRUE;
|
|
125
|
+ return OK;
|
|
126
|
+}
|
|
127
|
+
|
|
128
|
+/**
|
|
129
|
+ *
|
|
130
|
+ */
|
|
131
|
+int noecho ( void ) {
|
|
132
|
+ m_echo = FALSE;
|
|
133
|
+ return OK;
|
|
134
|
+}
|