Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 14:24:54 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        "A. Wright" <andrew@qemg.org>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Text mode screen size max. compatibility
Message-ID:  <20100723192454.GB7343@dan.emsphone.com>
In-Reply-To: <20100723210814.44ff8bd1.freebsd@edvax.de>
References:  <20100723202450.ea80c86f.freebsd@edvax.de> <alpine.BSF.2.00.1007231535211.1633@qemg.org> <20100723210814.44ff8bd1.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 23), Polytropon said:
> On Fri, 23 Jul 2010 15:44:27 -0300 (ADT), "A. Wright" <andrew@qemg.org> wrote:
> > 
> > On Fri, 23 Jul 2010, Polytropon wrote:
> > > Is there a way to easily determine the terminal output size at program
> > > startup so the program can be preconfigured for certain screen sizes,
> > > and even refuse to run if it's less than 80x25?
> > 
> > The "curses" library will do this.  The variables LINES and COLS will
> > tell you what you want.
> 
> Cool - I planned to use (n)curses anyway. But one question remains: Is
> there an "interrupt line" (or something functionally similar, a flag or
> whatever) that will give the chance for a notification if LINES or COLS
> has recently changed, e.  g.  through a window size modification?

If you haven't trapped the SIGWINCH signal (which is sent on terminal size
changes) yourself, ncurses will install its own handler.  It will queue a
virtual KEY_RESIZE keypress that you can check for in your input loop.  You
can then redraw your display to fit the new window size.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100723192454.GB7343>