aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-07-29 18:35:02 +0000
committerChristopher Faylor <me@cgf.cx>2000-07-29 18:35:02 +0000
commit600fee243cf8bf44e1528175871b90670e51d277 (patch)
treef5913e5ff9bae78d3749649f8c173ea2b76f3bc8
parent59c35fb576da35e557b1c1effe4b82b577430d5d (diff)
downloadnewlib-600fee243cf8bf44e1528175871b90670e51d277.zip
newlib-600fee243cf8bf44e1528175871b90670e51d277.tar.gz
newlib-600fee243cf8bf44e1528175871b90670e51d277.tar.bz2
* fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode if it
is not detected and it is less than ' '.
-rw-r--r--winsup/cygwin/fhandler_console.cc29
1 files changed, 28 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index bd58c3a..1ef2d29 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -110,6 +110,23 @@ set_console_state_for_spawn ()
return 1;
}
+void
+fhandler_console::set_cursor_maybe ()
+{
+ CONSOLE_SCREEN_BUFFER_INFO now;
+ static CONSOLE_SCREEN_BUFFER_INFO last = {{0, 0}, {-1, -1}, 0, {0, 0}, {0, 0}};
+
+ if (!GetConsoleScreenBufferInfo (get_output_handle(), &now))
+ return;
+
+ if (last.dwCursorPosition.X != now.dwCursorPosition.X ||
+ last.dwCursorPosition.Y != now.dwCursorPosition.Y)
+ {
+ SetConsoleCursorPosition (get_output_handle (), now.dwCursorPosition);
+ last.dwCursorPosition = now.dwCursorPosition;
+ }
+}
+
int
fhandler_console::read (void *pv, size_t buflen)
{
@@ -147,7 +164,7 @@ fhandler_console::read (void *pv, size_t buflen)
if ((bgres = bg_check (SIGTTIN)) <= 0)
return bgres;
- cursor_rel (0,0); /* to make cursor appear on the screen immediately */
+ set_cursor_maybe (); /* to make cursor appear on the screen immediately */
switch (WaitForMultipleObjects (nwait, w4, FALSE, INFINITE))
{
case WAIT_OBJECT_0:
@@ -1244,6 +1261,7 @@ fhandler_console::write (const void *vsrc, size_t len)
break;
}
}
+
syscall_printf ("%d = write_console (,..%d)", len, len);
return len;
@@ -1279,6 +1297,8 @@ static struct {
{VK_NUMPAD5, {"\033[G", NULL, NULL, NULL}},
{VK_CLEAR, {"\033[G", NULL, NULL, NULL}},
{'6', {NULL, NULL, "\036", NULL}},
+ /* FIXME: Should this be \033OQ? */
+ {VK_DIVIDE, {"/", "/", "/", "/"}},
{0, {"", NULL, NULL, NULL}}
};
@@ -1304,6 +1324,13 @@ get_nonascii_key (INPUT_RECORD& input_rec)
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
return keytable[i].val[modifier_index];
+ if (input_rec.Event.KeyEvent.wVirtualKeyCode < 127)
+ {
+ /* FIXME: Probably not thread-safe */
+ static char buf[2];
+ buf[0] = input_rec.Event.KeyEvent.wVirtualKeyCode;
+ return buf;
+ }
return NULL;
}