[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: resize
From: |
Thomas Dickey |
Subject: |
Re: resize |
Date: |
Mon, 21 Jun 2004 15:05:03 -0400 (EDT) |
On Mon, 21 Jun 2004, Folkert van Heusden wrote:
> Hi,
>
> I was wondering: what is *the* procedure for handling screenrefreshes?
It depends on what you are trying to do. ncurses has a sigwinch handler,
which will make wgetch return KEY_RESIZE when a SIGWINCH is detected (and
will call resizeterm in wgetch automatically).
> I saw endwin() + refresh() but also someone doing endwin() and initscr().
endwin/refresh will work, but causes more repainting than I'd like
(the reason for making ncurses's sigwinch handler work properly).
endwin/initscr will dump core on some implementations; X/Open notes
that a portable application should not call initscr more than once.
(It happens to work with ncurses)
> Furthermore: when should I do the resizeterm and such?
> I'm asking this since in some situation resizing seems to fail.
>
> What I'm doing now is:
> SIGWINCH-handler:
> ioctl(1, TIOCGWINSZ, &size);
> max_y = size.ws_row;
> max_x = size.ws_col;
>
> and after that (NOT in the signalhandler itself: I use some global variable
> to alert the main loop):
>
> resizeterm(max_y, max_x);
> touchwin(stdscr);
the touchwin would be redundant.
> endwin();
> refresh();
...but that should work
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
- resize, Folkert van Heusden, 2004/06/21
- Re: resize,
Thomas Dickey <=