| Author |
ncurses getch SIGWINCH
|
|
| Average Joe 2005-01-27, 2:51 am |
| My program sits in a blocking ncurses getch() call. When I receive the
signal SIGWINCH (screen resize), how do I inject a character into the
stdin so that getch will wake up?
I know I can use a non-blocking getch() call but it rails the CPU, and
sleeping is inefficient.
--
Average Joe
| |
| DINH Viet Hoa 2005-01-27, 7:54 am |
| Average Joe wrote :
> My program sits in a blocking ncurses getch() call. When I receive the
> signal SIGWINCH (screen resize), how do I inject a character into the
> stdin so that getch will wake up?
>
> I know I can use a non-blocking getch() call but it rails the CPU, and
> sleeping is inefficient.
use select() with a timeout of 0.1 sec (sufficient most of time for
user interface) before getch()
--
DINH V. Hoa,
"Paraît-il que c'est ce que recherchent la majorité des djeunz. Il n'y a plus
aucun attrait pour les métiers scientifiques ni techniques. Ils veulent être
chanteur, acteur ou fonctionnaire. C'est désépérant..." -- Emmanuel Delahaye
| |
|
| Ncurses will (or perhaps it has to be enabled) return KEY_RESIZE from
getch() so you can handle it that way.
| |
| Thomas Dickey 2005-01-28, 8:47 pm |
| alexs <spam@alexs.org> wrote:
> Ncurses will (or perhaps it has to be enabled) return KEY_RESIZE from
> getch() so you can handle it that way.
yes - the SIGWINCH handler is normally compiled-in.
But it may be overridden by defining another handler.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
| |
| Average Joe 2005-01-29, 5:54 pm |
| Thomas Dickey wrote:
> alexs <spam@alexs.org> wrote:
>
>
>
> yes - the SIGWINCH handler is normally compiled-in. But it may be
> overridden by defining another handler.
Even with halfdelay(1) set, it appears KEY_RESIZE isn't returned from
getch() when the screen is resizing until after a doupdate() is issued.
Can anyone verify this?
This means I always have to issue a doupdate() when getch() returns ERR,
just to catch the resize "in the act."
Is this intended behavior?
--
Average Joe
| |
| Average Joe 2005-01-29, 5:54 pm |
| > This means I always have to issue a doupdate() when getch() returns
> ERR, just to catch the resize "in the act."
I am using Linux FC3. Does this happen to anyone else?
When resizing during a getch(), getch() returns ERR with errno == EINTR.
After this, the next call to getch() will return KEY_RESIZE only if a
doupdate() has been issued.
This seems to be broken behavior. Is this the intended behavior?
--
Average Joe
| |
| Thomas Dickey 2005-01-31, 8:51 pm |
| Average Joe <joe@use.net> wrote:
> Even with halfdelay(1) set, it appears KEY_RESIZE isn't returned from
> getch() when the screen is resizing until after a doupdate() is issued.
> Can anyone verify this?
I've run into that before, but not for quite a while (and don't recall
exactly what the problem was that produces this symptom).
> Is this intended behavior?
no
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
| |
| Thomas Dickey 2005-01-31, 8:51 pm |
| Average Joe <joe@use.net> wrote:
[vbcol=seagreen]
> I am using Linux FC3. Does this happen to anyone else?
> When resizing during a getch(), getch() returns ERR with errno == EINTR.
> After this, the next call to getch() will return KEY_RESIZE only if a
> doupdate() has been issued.
> This seems to be broken behavior. Is this the intended behavior?
no (but you could post a short test program so we could see exactly the
same result).
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
|
|
|
|