diff options
author | Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> | 2020-06-04 04:43:19 +0300 |
---|---|---|
committer | Ken Brown <kbrown@cornell.edu> | 2020-06-06 04:34:52 +0300 |
commit | 8014dc709922a0d9934540d79257fe899544046f (patch) | |
tree | 6596d6d29299ee015e2af5db93ab53e55299c3c5 /winsup/cygwin/tty.cc | |
parent | e6ce6f1430eee503a388cf1fc7fe6634de09fb0f (diff) |
Cygwin: pty: Fix screen distortion after less for native apps again.
- Commit c4b060e3fe3bed05b3a69ccbcc20993ad85e163d seems to be not
enough. Moreover, it does not work as expected at all in Win10
1809. This patch essentially reverts that commit and add another
fix. After all, the cause of the problem was a race issue in
switch_to_pcon_out flag. That is, this flag is set when native
app starts, however, it is delayed by wait_pcon_fwd(). Since the
flag is not set yet when less starts, the data which should go
into the output_handle accidentally goes into output_handle_cyg.
This patch fixes the problem more essentially for the cause of
the problem than previous one.
Diffstat (limited to 'winsup/cygwin/tty.cc')
-rw-r--r-- | winsup/cygwin/tty.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index efdae4697..4cb68f776 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -244,7 +244,6 @@ tty::init () pcon_pid = 0; term_code_page = 0; need_redraw_screen = true; - fwd_done = NULL; pcon_last_time = 0; pcon_in_empty = true; req_transfer_input_to_pcon = false; @@ -307,6 +306,12 @@ tty::set_switch_to_pcon_out (bool v) void tty::wait_pcon_fwd (void) { + /* The forwarding in pseudo console sometimes stops for + 16-32 msec even if it already has data to transfer. + If the time without transfer exceeds 32 msec, the + forwarding is supposed to be finished. pcon_last_time + is reset to GetTickCount() in pty master forwarding + thread when the last data is transfered. */ const int sleep_in_pcon = 16; const int time_to_wait = sleep_in_pcon * 2 + 1/* margine */; pcon_last_time = GetTickCount (); |