Cygwin: pty: Stop to send CTRL_C_EVENT if pcon activated.
- The commit "Cygwin: console: Redesign handling of special keys." removes special treatment for pty in with pseudo console activated, however, it is necessary on second thought. This is because sending CTRL_C_EVENT to non-cygwin apps will be done in pseudo console, therefore, sending it in fhandler_pty_master::write() duplicates that event for non-cygwin apps.
This commit is contained in:
parent
32401ad98e
commit
e9d4341677
|
@ -1958,6 +1958,7 @@ class fhandler_termios: public fhandler_base
|
||||||
virtual void cleanup_before_exit () {}
|
virtual void cleanup_before_exit () {}
|
||||||
virtual void setpgid_aux (pid_t pid) {}
|
virtual void setpgid_aux (pid_t pid) {}
|
||||||
virtual bool need_console_handler () { return false; }
|
virtual bool need_console_handler () { return false; }
|
||||||
|
virtual bool need_send_ctrl_c_event () { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ansi_intensity
|
enum ansi_intensity
|
||||||
|
@ -2492,6 +2493,7 @@ public:
|
||||||
void get_master_thread_param (master_thread_param_t *p);
|
void get_master_thread_param (master_thread_param_t *p);
|
||||||
void get_master_fwd_thread_param (master_fwd_thread_param_t *p);
|
void get_master_fwd_thread_param (master_fwd_thread_param_t *p);
|
||||||
void set_mask_flusho (bool m) { get_ttyp ()->mask_flusho = m; }
|
void set_mask_flusho (bool m) { get_ttyp ()->mask_flusho = m; }
|
||||||
|
bool need_send_ctrl_c_event ();
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_dev_null: public fhandler_base
|
class fhandler_dev_null: public fhandler_base
|
||||||
|
|
|
@ -359,16 +359,12 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
|
||||||
instead. */
|
instead. */
|
||||||
if ((p->process_state & PID_NEW_PG)
|
if ((p->process_state & PID_NEW_PG)
|
||||||
&& (p->process_state & PID_NOTCYGWIN))
|
&& (p->process_state & PID_NOTCYGWIN))
|
||||||
{
|
GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, p->dwProcessId);
|
||||||
GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT,
|
else if ((!fh || fh->need_send_ctrl_c_event () || cyg_leader)
|
||||||
p->dwProcessId);
|
&& !ctrl_c_event_sent)
|
||||||
need_discard_input = true;
|
|
||||||
}
|
|
||||||
else if (!ctrl_c_event_sent)
|
|
||||||
{
|
{
|
||||||
GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
|
GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
|
||||||
ctrl_c_event_sent = true;
|
ctrl_c_event_sent = true;
|
||||||
need_discard_input = true;
|
|
||||||
}
|
}
|
||||||
if (resume_pid && fh && !fh->is_console ())
|
if (resume_pid && fh && !fh->is_console ())
|
||||||
{
|
{
|
||||||
|
@ -377,6 +373,7 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
|
||||||
if (::cygheap->ctty && ::cygheap->ctty->is_console ())
|
if (::cygheap->ctty && ::cygheap->ctty->is_console ())
|
||||||
init_console_handler (true);
|
init_console_handler (true);
|
||||||
}
|
}
|
||||||
|
need_discard_input = true;
|
||||||
}
|
}
|
||||||
if (p && p->ctty == ttyp->ntty && p->pgid == pgid)
|
if (p && p->ctty == ttyp->ntty && p->pgid == pgid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4105,3 +4105,14 @@ fhandler_pty_slave::setpgid_aux (pid_t pid)
|
||||||
}
|
}
|
||||||
ReleaseMutex (pcon_mutex);
|
ReleaseMutex (pcon_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
fhandler_pty_master::need_send_ctrl_c_event ()
|
||||||
|
{
|
||||||
|
/* If pseudo console is activated, sending CTRL_C_EVENT to non-cygwin
|
||||||
|
apps will be done in pseudo console, therefore, sending it in
|
||||||
|
fhandler_pty_master::write() duplicates that event for non-cygwin
|
||||||
|
apps. So return false if pseudo console is activated. */
|
||||||
|
return !(to_be_read_from_pcon () && get_ttyp ()->pcon_activated
|
||||||
|
&& get_ttyp ()->pcon_input_state == tty::to_nat);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue