[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ocaml-tmk-devel] Handling xterm resizing

From: Paul Pelzl
Subject: Re: [Ocaml-tmk-devel] Handling xterm resizing
Date: Mon, 1 Nov 2010 12:33:26 -0500

On Sun, Oct 31, 2010 at 11:14 PM, Erik de Castro Lopo <address@hidden> wrote:
Code follows.

On my Debian system (libcurses-ocaml 1.0.3-1+b1), this example seems to behave pretty reasonably if I remove the call to Curses.winch_handler_on.

By default, the 'configure' script for ncurses will enable its built-in SIGWINCH handler (which passes KEY_RESIZE through to getch()/wgetch() ).  Therefore you don't need to install a SIGWINCH handler unless you have an oddly-configured ncurses, or unless you want to define different behavior for SIGWINCH.

Unfortunately, I think there is a bug here: it looks to me like the ocaml-curses implementation of Curses.winch_handler_on is venturing into unsafe territory by attempting to call ungetch() from a signal handler context.  It seems unlikely that ungetch() is a "safe function" in the POSIX signal sense, so I'm not too surprised that the input queue fails to update correctly when a resize event occurs.

(By way of comparison, the ncurses built-in SIGWINCH handler just sets a flag that gets intercepted in the mainloop.)

Hope that helps,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]