summaryrefslogtreecommitdiffstats
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-04-21 18:53:05 +0000
committerChristopher Faylor <me@cgf.cx>2006-04-21 18:53:05 +0000
commitf09acf77dea138412eebf78d361ba94433f4a375 (patch)
treefceeda93289dfe25af40420ac7fa13f9bb18ea58 /winsup
parent33b0abd1c32ac1c49c31039a89ebf00480b64439 (diff)
downloadcygnal-f09acf77dea138412eebf78d361ba94433f4a375.tar.gz
cygnal-f09acf77dea138412eebf78d361ba94433f4a375.tar.bz2
cygnal-f09acf77dea138412eebf78d361ba94433f4a375.zip
* 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.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog15
-rw-r--r--winsup/cygwin/dtable.cc6
-rw-r--r--winsup/cygwin/fhandler_console.cc1
-rw-r--r--winsup/cygwin/fhandler_termios.cc1
-rw-r--r--winsup/cygwin/tty.h25
5 files changed, 33 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d4efcd112..c81194ac8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 74ce74b67..f22be554e 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -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;
}
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 801ab5a6a..64a83ce66 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -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;
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index 3475f5ed5..9b8d3597e 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -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:
diff --git a/winsup/cygwin/tty.h b/winsup/cygwin/tty.h
index c8a266e91..27e517d9c 100644
--- a/winsup/cygwin/tty.h
+++ b/winsup/cygwin/tty.h
@@ -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 ();