From 66dcfc4498cbccf5c694c2009179259dc6e5efb1 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 27 Dec 2002 05:31:30 +0000 Subject: * 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. --- winsup/cygwin/fhandler_tty.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/fhandler_tty.cc') diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index fd0789b60..1f552ceaf 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 -- cgit v1.2.3