bug-ncurses
[Top][All Lists]
Advanced

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

Re: Can you use getch() without all the other stuff?


From: Avery Pennarun
Subject: Re: Can you use getch() without all the other stuff?
Date: Thu, 27 Dec 2007 17:56:42 -0500

On 27/12/2007, Steve Litt <address@hidden> wrote:
> They probably are what I want. As far as I know, getc() in raw mode can'd
> differentiate between F3, Shift+F3, Alt+F3, or Ctrl+F3. I need to be able to
> do that.
>
> The only way I've been able to find to do that is to intercept press and
> release scan codes, keep track of the state of every modifier key, and when a
> non-modifier key is released, modify the released character accordingly. If
> anyone knows of an easier way, please let me know.

The problem is that each terminal emulator will do that stuff slightly
differently.  For example, the terminal application in my MacOS X
machine (just the computer that was nearest at the moment :)) seems to
be able to deliver F3 and Alt-F3 (different codes), but not Ctrl-F3 or
Shift-F3.

Beyond that, it's unlikely that all the terminfo entries will have the
right keys, or that you're using exactly the right terminfo.  My MacOS
X terminal claims to be "rxvt", which it certainly isn't (although it
might be *based on* rxvt).

If you're just using the raw Linux console, though, kbd_mode will help
a lot.  If you're in X, you might want to just write a real X
application and save yourself the confusion.

Have fun,

Avery




reply via email to

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