|
| 1 | +From 6673d8e1b8a1be0e06528735d5375e1891bbe997 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Takashi Yano < [email protected]> |
| 3 | +Date: Thu, 3 Jul 2025 10:51:09 +0900 |
| 4 | +Subject: [PATCH 56/N] Cygwin: console: Call set_input_mode() after changing |
| 5 | + disable_master_thread |
| 6 | + |
| 7 | +With the commit 476135a24506, set_input_mode() reffers to the flag |
| 8 | +disable_master_thread in tty::cygwin mode. So it is necessary to call |
| 9 | +set_input_mode() after changing disable_master_thread flag. However, |
| 10 | +the commit 476135a24506 was missing that. |
| 11 | + |
| 12 | +With this patch, set_input_mode() is called after changing the flag |
| 13 | +disable_master_thread, if the console input mode is tty::cygwin. |
| 14 | + |
| 15 | +Fixes: 476135a24506 ("Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread"); |
| 16 | +Signed-off-by: Takashi Yano < [email protected]> |
| 17 | +Cherry-picked-from: 65a48c7202 (Cygwin: console: Call set_input_mode() after changing disable_master_thread, 2025-07-03) |
| 18 | +Signed-off-by: Johannes Schindelin < [email protected]> |
| 19 | +--- |
| 20 | + winsup/cygwin/fhandler/console.cc | 13 +++++++++---- |
| 21 | + 1 file changed, 9 insertions(+), 4 deletions(-) |
| 22 | + |
| 23 | +diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc |
| 24 | +index 48c9326..831df4f 100644 |
| 25 | +--- a/winsup/cygwin/fhandler/console.cc |
| 26 | ++++ b/winsup/cygwin/fhandler/console.cc |
| 27 | +@@ -923,12 +923,12 @@ fhandler_console::cleanup_for_non_cygwin_app (handle_set_t *p) |
| 28 | + termios *ti = shared_console_info[unit] ? |
| 29 | + &(shared_console_info[unit]->tty_min_state.ti) : &dummy; |
| 30 | + /* Cleaning-up console mode for non-cygwin app. */ |
| 31 | ++ set_disable_master_thread (con.owner == GetCurrentProcessId ()); |
| 32 | + /* conmode can be tty::restore when non-cygwin app is |
| 33 | + exec'ed from login shell. */ |
| 34 | + tty::cons_mode conmode = cons_mode_on_close (p); |
| 35 | + set_output_mode (conmode, ti, p); |
| 36 | + set_input_mode (conmode, ti, p); |
| 37 | +- set_disable_master_thread (con.owner == GetCurrentProcessId ()); |
| 38 | + } |
| 39 | + |
| 40 | + /* Return the tty structure associated with a given tty number. If the |
| 41 | +@@ -1121,8 +1121,8 @@ fhandler_console::bg_check (int sig, bool dontsignal) |
| 42 | + in the same process group. */ |
| 43 | + if (sig == SIGTTIN && con.curr_input_mode != tty::cygwin) |
| 44 | + { |
| 45 | +- set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ()); |
| 46 | + set_disable_master_thread (false, this); |
| 47 | ++ set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ()); |
| 48 | + } |
| 49 | + if (sig == SIGTTOU && con.curr_output_mode != tty::cygwin) |
| 50 | + set_output_mode (tty::cygwin, &tc ()->ti, get_handle_set ()); |
| 51 | +@@ -1987,8 +1987,8 @@ fhandler_console::post_open_setup (int fd) |
| 52 | + /* Setting-up console mode for cygwin app started from non-cygwin app. */ |
| 53 | + if (fd == 0) |
| 54 | + { |
| 55 | +- set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set); |
| 56 | + set_disable_master_thread (false, this); |
| 57 | ++ set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set); |
| 58 | + } |
| 59 | + else if (fd == 1 || fd == 2) |
| 60 | + set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set); |
| 61 | +@@ -2995,7 +2995,12 @@ fhandler_console::char_command (char c) |
| 62 | + if (con.args[i] == 1) /* DECCKM */ |
| 63 | + con.cursor_key_app_mode = (c == 'h'); |
| 64 | + 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) */ |
| 65 | +- set_disable_master_thread (c == 'h', this); |
| 66 | ++ { |
| 67 | ++ set_disable_master_thread (c == 'h', this); |
| 68 | ++ if (con.curr_input_mode == tty::cygwin) |
| 69 | ++ set_input_mode (tty::cygwin, |
| 70 | ++ &tc ()->ti, get_handle_set ()); |
| 71 | ++ } |
| 72 | + } |
| 73 | + /* Call fix_tab_position() if screen has been alternated. */ |
| 74 | + if (need_fix_tab_position) |
0 commit comments