[PATCH] Cygwin: console: Call set_input_mode() after changing disable_master_thread
Takashi Yano
takashi.yano@nifty.ne.jp
Thu Jul 3 02:01:44 GMT 2025
With the commit 476135a24506, set_input_mode() reffers to the flag
disable_master_thread in tty::cygwin mode. So it is necessary to call
set_input_mode() after changing disable_master_thread flag. However,
the commit 476135a24506 was missing that.
With this patch, set_input_mode() is called after changing the flag
disable_master_thread, if the console input mode is tty::cygwin.
Fixes: 476135a24506 ("Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread");
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
winsup/cygwin/fhandler/console.cc | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index 1ae4c639a..c572951b7 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -923,12 +923,12 @@ fhandler_console::cleanup_for_non_cygwin_app (handle_set_t *p)
termios *ti = shared_console_info[unit] ?
&(shared_console_info[unit]->tty_min_state.ti) : &dummy;
/* Cleaning-up console mode for non-cygwin app. */
+ set_disable_master_thread (con.owner == GetCurrentProcessId ());
/* conmode can be tty::restore when non-cygwin app is
exec'ed from login shell. */
tty::cons_mode conmode = cons_mode_on_close (p);
set_output_mode (conmode, ti, p);
set_input_mode (conmode, ti, p);
- set_disable_master_thread (con.owner == GetCurrentProcessId ());
}
/* Return the tty structure associated with a given tty number. If the
@@ -1121,8 +1121,8 @@ fhandler_console::bg_check (int sig, bool dontsignal)
in the same process group. */
if (sig == SIGTTIN && con.curr_input_mode != tty::cygwin)
{
- set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
set_disable_master_thread (false, this);
+ set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
}
if (sig == SIGTTOU && con.curr_output_mode != tty::cygwin)
set_output_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
@@ -1996,8 +1996,8 @@ fhandler_console::post_open_setup (int fd)
/* Setting-up console mode for cygwin app started from non-cygwin app. */
if (fd == 0)
{
- set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
set_disable_master_thread (false, this);
+ set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
}
else if (fd == 1 || fd == 2)
set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
@@ -3013,7 +3013,12 @@ fhandler_console::char_command (char c)
if (con.args[i] == 1) /* DECCKM */
con.cursor_key_app_mode = (c == 'h');
if (con.args[i] == 9001) /* win32-input-mode (https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md) */
- set_disable_master_thread (c == 'h', this);
+ {
+ set_disable_master_thread (c == 'h', this);
+ if (con.curr_input_mode == tty::cygwin)
+ set_input_mode (tty::cygwin,
+ &tc ()->ti, get_handle_set ());
+ }
}
/* Call fix_tab_position() if screen has been alternated. */
if (need_fix_tab_position)
--
2.45.1
More information about the Cygwin-patches
mailing list