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: Steve Litt
Subject: Re: Can you use getch() without all the other stuff?
Date: Thu, 27 Dec 2007 17:50:39 -0500
User-agent: KMail/1.9.4

On Thursday 27 December 2007 15:20, you wrote:
> On 24/12/2007, Steve Litt <address@hidden> wrote:
> > Is there a way to use ncurse's getch() without loading up all the other
> > ncurses stuff? I'd like to read raw (I'd really like to be able to read
> > scancodes but I don't think getch() does that), but without the memory
> > leaks and overhead of screen manipulation.
>
> You probably don't need ncurses for this at all.  Just put the tty
> into raw mode (equivalent of "stty raw") and use the standard stdio
> functions to read bytes.
>
> If you really want "scan codes", look at the Linux kbd_mode command.
> Beware that these probably are not *actually* what you want :)

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.

Thanks

SteveT




reply via email to

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