octave-maintainers
[Top][All Lists]
Advanced

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

Re: Detaching from terminal and keyboard input for GUI


From: John W. Eaton
Subject: Re: Detaching from terminal and keyboard input for GUI
Date: Mon, 13 May 2013 22:30:27 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

On 05/13/2013 08:03 PM, Michael Goffioul wrote:
On Mon, May 13, 2013 at 7:49 PM, John W. Eaton <address@hidden
<mailto:address@hidden>> wrote:

    On 05/13/2013 07:44 PM, Michael Goffioul wrote:

        At the very least, we should at least check the return value of
        ioctl.


    And do what with it?


Well, first that would be a way to know whether the process successfully
detached from the controlling terminal. If it didn't, then things like
CTRL-C won't work. Second, if it failed, you could fall back to another
mechanism, like the previous fork-based one or any other one.

On my system, the ioctl succeeds, but doesn't do the full job.  It
does appear to close /dev/tty so that less will work in the terminal
widget, but it doesn't completely detach from the controlling
terminal.

If I use the fork+setsid code and remove all the shortcuts that use
the CTRL-C and CTRL-V key sequences, then I see that CTRL-V is
delivered to readline, but CTRL-C is still being grabbed somewhere.

If I use "stty intr ^G" before starting Octave, "stty -a" shows that
CTRL-G is bound to the interrupt signal, but CTRL-C is still
apparently not getting through.

Also, if I add

  set bind-tty-special-chars 0
  "\C-v": clear-screen
  "\C-c": clear-screen

to my ~/.inputrc file, then CTRL-V does clear the screen, but CTRL-C
does not.  Disabling bind-tty-special-chars is needed because CTRL-V
is bound to the tty setting lnext on my system.

If I try "stty lnext ^G" and not disabling bind-tty-special-chars in
readline, then CTRL-V keeps it's usual readline definition
(quoted-insert).  So I assume my current terminal settings are ignored
and Octave is getting the defaults somehow.

My only other thought is to disable all special tty settings and any
Qt shortcut keys that apply to the terminal widget, let readline get
all these characters, and define readline functions for them that do
whatever is necessary to invoke the appropriate actions: interrupting
Octave, performing readline or GUI actions.  It looks like that also
has a chance of working with the Windows terminal as well.

I still have no clue about how to detach from the controlling terminal
on OS X.  Apparently forking won't work, but we haven't found anything
else that will either.

jwe


reply via email to

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