Re: [PATCH 1/1] Cygwin: console: fix key input for native console application

2019-04-03 Thread Corinna Vinschen
On Apr  4 01:25, Takashi Yano wrote:
> - 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.
> ---
>  winsup/cygwin/fhandler_console.cc | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/winsup/cygwin/fhandler_console.cc 
> b/winsup/cygwin/fhandler_console.cc
> index d2e3184a6..335467b0b 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 |= ENABLE_VIRTUAL_TERMINAL_INPUT;
> +  SetConsoleMode (get_handle (), dwMode);
> +}
> +
>char tmp[60];
>  
>if (!shared_console_info)
> @@ -2894,6 +2903,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 &= ~ENABLE_VIRTUAL_TERMINAL_INPUT;
> +  SetConsoleMode (get_handle (), dwMode);
> +}
>  }
>  
>  // #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | 
> STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)
> -- 
> 2.17.0

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


[PATCH 1/1] Cygwin: console: fix key input for native console application

2019-04-03 Thread Takashi Yano
- 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.
---
 winsup/cygwin/fhandler_console.cc | 17 +
 1 file changed, 17 insertions(+)

diff --git a/winsup/cygwin/fhandler_console.cc 
b/winsup/cygwin/fhandler_console.cc
index d2e3184a6..335467b0b 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 |= ENABLE_VIRTUAL_TERMINAL_INPUT;
+  SetConsoleMode (get_handle (), dwMode);
+}
+
   char tmp[60];
 
   if (!shared_console_info)
@@ -2894,6 +2903,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 &= ~ENABLE_VIRTUAL_TERMINAL_INPUT;
+  SetConsoleMode (get_handle (), dwMode);
+}
 }
 
 // #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | 
STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)
-- 
2.17.0