diff options
author | Christopher Faylor <me@cgf.cx> | 2002-12-27 05:31:30 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-12-27 05:31:30 +0000 |
commit | 66dcfc4498cbccf5c694c2009179259dc6e5efb1 (patch) | |
tree | 7a4f7204fb377063049c7514579e1478a09b243c /winsup | |
parent | 3bfed277d69246e7ae67caec77969180d9e51538 (diff) | |
download | newlib-66dcfc4498cbccf5c694c2009179259dc6e5efb1.zip newlib-66dcfc4498cbccf5c694c2009179259dc6e5efb1.tar.gz newlib-66dcfc4498cbccf5c694c2009179259dc6e5efb1.tar.bz2 |
* fhandler.h (fhandler_tty_master::set_winsize): Declare new function.
* fhandler_console.cc (fhandler_console::send_winch_maybe): If appropriate,
call tty master function to handle screen size change.
* fhandler_tty.cc (fhandler_tty_master::set_winsize): New function.
(fhandler_tty_master::init): Call set_winsize to set initial screen size.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/fhandler.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 17 |
3 files changed, 21 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 43db444..f0dde37 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -948,6 +948,7 @@ class fhandler_tty_master: public fhandler_pty_master fhandler_tty_master (int unit); int init (int); int init_console (); + void set_winsize (bool); void fixup_after_fork (HANDLE parent); void fixup_after_exec (HANDLE); }; diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 41c1cca..22dc69e 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -213,7 +213,13 @@ fhandler_console::send_winch_maybe () fillin_info (); if (y != dev_state->info.dwWinSize.Y || x != dev_state->info.dwWinSize.X) - tc->kill_pgrp (SIGWINCH); + { + extern fhandler_tty_master *tty_master; + if (tty_master) + tty_master->set_winsize (true); + else + tc->kill_pgrp (SIGWINCH); + } } void __stdcall diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index fd0789b..1f552ce 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -40,6 +40,16 @@ fhandler_tty_master::fhandler_tty_master (int unit) { } +void +fhandler_tty_master::set_winsize (bool sendSIGWINCH) +{ + winsize w; + console->ioctl (TIOCGWINSZ, &w); + get_ttyp ()->winsize = w; + if (sendSIGWINCH) + tc->kill_pgrp (SIGWINCH); +} + int fhandler_tty_master::init (int ntty) { @@ -54,14 +64,13 @@ fhandler_tty_master::init (int ntty) termios ti; memset (&ti, 0, sizeof (ti)); console->tcsetattr (0, &ti); - winsize w; - console->ioctl (TIOCGWINSZ, &w); - this->ioctl (TIOCSWINSZ, &w); ttynum = ntty; cygwin_shared->tty[ttynum]->common_init (this); + set_winsize (false); + inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE); cygthread *h; @@ -1134,7 +1143,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg) pktmode = * (int *) arg; break; case TIOCGWINSZ: - * (struct winsize *) arg = get_ttyp ()->winsize; + *(struct winsize *) arg = get_ttyp ()->winsize; break; case TIOCSWINSZ: if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row |