* tty.h (tty::hwnd): Move to tty_min.
(tty::gethwnd): Ditto. (tty::sethwnd): Ditto. (tty_min::hwnd): Receive variable from tty class. (tty_min::gethwnd): Receive function from tty classs. (tty_min::sethwnd): Ditto. * dtable.cc (dtable::stdio_init): Only call init_console_handler when we actually own the console. * fhandler_console.cc (fhandler_console::get_tty_stuff): Set tty's hwnd to non-zero value. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Semi-reinstate handling of console when pgrp is set.
This commit is contained in:
		@@ -1,3 +1,18 @@
 | 
			
		||||
2006-04-21  Christopher Faylor  <cgf@timesys.com>
 | 
			
		||||
 | 
			
		||||
	* tty.h (tty::hwnd): Move to tty_min.
 | 
			
		||||
	(tty::gethwnd): Ditto.
 | 
			
		||||
	(tty::sethwnd): Ditto.
 | 
			
		||||
	(tty_min::hwnd): Receive variable from tty class.
 | 
			
		||||
	(tty_min::gethwnd): Receive function from tty classs.
 | 
			
		||||
	(tty_min::sethwnd): Ditto.
 | 
			
		||||
	* dtable.cc (dtable::stdio_init): Only call init_console_handler when
 | 
			
		||||
	we actually own the console.
 | 
			
		||||
	* fhandler_console.cc (fhandler_console::get_tty_stuff): Set tty's hwnd
 | 
			
		||||
	to non-zero value.
 | 
			
		||||
	* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Semi-reinstate
 | 
			
		||||
	handling of console when pgrp is set.
 | 
			
		||||
 | 
			
		||||
2006-04-21  Pierre Humblet  <Pierre.Humblet@ieee.org>
 | 
			
		||||
	    Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ details. */
 | 
			
		||||
#include "dtable.h"
 | 
			
		||||
#include "cygheap.h"
 | 
			
		||||
#include "ntdll.h"
 | 
			
		||||
#include "tty.h"
 | 
			
		||||
#include "shared_info.h"
 | 
			
		||||
 | 
			
		||||
static const char NO_COPY unknown_file[] = "some disk file";
 | 
			
		||||
 | 
			
		||||
@@ -135,7 +135,9 @@ dtable::stdio_init ()
 | 
			
		||||
 | 
			
		||||
  if (myself->cygstarted || ISSTATE (myself, PID_CYGPARENT))
 | 
			
		||||
    {
 | 
			
		||||
      init_console_handler (myself->ctty >= 0);
 | 
			
		||||
      tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);
 | 
			
		||||
      if (t && t->getpgid () == myself->pid && t->gethwnd ())
 | 
			
		||||
	init_console_handler (true);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -115,6 +115,7 @@ fhandler_console::get_tty_stuff (int flags = 0)
 | 
			
		||||
      if (PRIMARYLANGID (LOWORD (GetKeyboardLayout (0))) == LANG_ENGLISH)
 | 
			
		||||
	dev_state->meta_mask |= RIGHT_ALT_PRESSED;
 | 
			
		||||
      dev_state->set_default_attr ();
 | 
			
		||||
      shared_console_info->tty_min_state.sethwnd ((HWND) INVALID_HANDLE_VALUE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return &shared_console_info->tty_min_state;
 | 
			
		||||
 
 | 
			
		||||
@@ -82,6 +82,7 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
 | 
			
		||||
	{
 | 
			
		||||
	case bg_ok:
 | 
			
		||||
	  tc->setpgid (pgid);
 | 
			
		||||
	  init_console_handler (tc->gethwnd ());
 | 
			
		||||
	  res = 0;
 | 
			
		||||
	  break;
 | 
			
		||||
	case bg_signalled:
 | 
			
		||||
 
 | 
			
		||||
@@ -46,18 +46,12 @@ public:
 | 
			
		||||
  pid_t pgid;
 | 
			
		||||
  int output_stopped;
 | 
			
		||||
  int ntty;
 | 
			
		||||
  DWORD last_ctrl_c;	// tick count of last ctrl-c
 | 
			
		||||
  DWORD last_ctrl_c;	/* tick count of last ctrl-c */
 | 
			
		||||
  HWND hwnd;		/* Console window handle tty belongs to */
 | 
			
		||||
 | 
			
		||||
  IMPLEMENT_STATUS_FLAG (bool, initialized)
 | 
			
		||||
  IMPLEMENT_STATUS_FLAG (bool, rstcons)
 | 
			
		||||
 | 
			
		||||
  tty_min (int t = -1, pid_t s = -1) : sid (s), ntty (t) {}
 | 
			
		||||
  void setntty (int n) {ntty = n;}
 | 
			
		||||
  pid_t getpgid () {return pgid;}
 | 
			
		||||
  void setpgid (int pid) {pgid = pid;}
 | 
			
		||||
  int getsid () {return sid;}
 | 
			
		||||
  void setsid (pid_t tsid) {sid = tsid;}
 | 
			
		||||
  void kill_pgrp (int sig);
 | 
			
		||||
  struct termios ti;
 | 
			
		||||
  struct winsize winsize;
 | 
			
		||||
 | 
			
		||||
@@ -74,8 +68,17 @@ public:
 | 
			
		||||
   * -ERRNO
 | 
			
		||||
   */
 | 
			
		||||
  int ioctl_retval;
 | 
			
		||||
 | 
			
		||||
  int write_error;
 | 
			
		||||
 | 
			
		||||
  tty_min (int t = -1, pid_t s = -1) : sid (s), ntty (t) {}
 | 
			
		||||
  void setntty (int n) {ntty = n;}
 | 
			
		||||
  pid_t getpgid () {return pgid;}
 | 
			
		||||
  void setpgid (int pid) {pgid = pid;}
 | 
			
		||||
  int getsid () {return sid;}
 | 
			
		||||
  void setsid (pid_t tsid) {sid = tsid;}
 | 
			
		||||
  void kill_pgrp (int sig);
 | 
			
		||||
  HWND gethwnd () {return hwnd;}
 | 
			
		||||
  void sethwnd (HWND wnd) {hwnd = wnd;}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class fhandler_pty_master;
 | 
			
		||||
@@ -85,8 +88,6 @@ class tty: public tty_min
 | 
			
		||||
  HANDLE get_event (const char *fmt, BOOL manual_reset = FALSE)
 | 
			
		||||
    __attribute__ ((regparm (3)));
 | 
			
		||||
public:
 | 
			
		||||
  HWND  hwnd;	/* Console window handle tty belongs to */
 | 
			
		||||
 | 
			
		||||
  DWORD master_pid;	/* Win32 PID of tty master process */
 | 
			
		||||
 | 
			
		||||
  HANDLE from_master, to_slave;
 | 
			
		||||
@@ -101,8 +102,6 @@ public:
 | 
			
		||||
  bool alive (const char *fmt);
 | 
			
		||||
  bool slave_alive ();
 | 
			
		||||
  bool master_alive ();
 | 
			
		||||
  HWND gethwnd () {return hwnd;}
 | 
			
		||||
  void sethwnd (HWND wnd) {hwnd = wnd;}
 | 
			
		||||
  bool make_pipes (fhandler_pty_master *ptym);
 | 
			
		||||
  HANDLE open_mutex (const char *mutex);
 | 
			
		||||
  HANDLE open_output_mutex ();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user