aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2019-04-04 01:25:31 +0900
committerCorinna Vinschen <corinna@vinschen.de>2019-04-03 18:45:14 +0200
commit6a06c6bc8f8492ea09aa3ae180fe94e4ac265611 (patch)
tree10564b9def6f192c66ba5a4a3649e90902211b86
parentd3a69d32b1b21b3885d3c8222c0c316be646ddf1 (diff)
downloadnewlib-6a06c6bc8f8492ea09aa3ae180fe94e4ac265611.zip
newlib-6a06c6bc8f8492ea09aa3ae180fe94e4ac265611.tar.gz
newlib-6a06c6bc8f8492ea09aa3ae180fe94e4ac265611.tar.bz2
Cygwin: console: fix key input for native console application
- After 24 bit color support patch, arrow keys and function keys do not work properly in native console applications if they are started in cygwin console. This patch fixes this issue.
-rw-r--r--winsup/cygwin/fhandler_console.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 6d42ed8..e3656a3 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -455,6 +455,15 @@ sig_exit:
fhandler_console::input_states
fhandler_console::process_input_message (void)
{
+ if (wincap.has_con_24bit_colors ())
+ {
+ DWORD dwMode;
+ /* Enable xterm compatible mode in input */
+ GetConsoleMode (get_handle (), &dwMode);
+ dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
+ SetConsoleMode (get_handle (), dwMode);
+ }
+
char tmp[60];
if (!shared_console_info)
@@ -2881,6 +2890,14 @@ fhandler_console::fixup_after_fork_exec (bool execing)
{
set_unit ();
setup_io_mutex ();
+ if (wincap.has_con_24bit_colors ())
+ {
+ DWORD dwMode;
+ /* Disable xterm compatible mode in input */
+ GetConsoleMode (get_handle (), &dwMode);
+ dwMode &= ~ENABLE_VIRTUAL_TERMINAL_INPUT;
+ SetConsoleMode (get_handle (), dwMode);
+ }
}
// #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)