bug-ncurses
[Top][All Lists]
Advanced

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

Re: alt key


From: Christ, Bryan
Subject: Re: alt key
Date: Thu, 07 Dec 2006 10:21:23 -0600

As long as your not dealing with wide/mb characters, here's how I handle
it.

gint32 get_keystroke(void)
{
        gint32  keystroke=0;
        gint    key_code=0;

        key_code=getch();
        if(key_code==-1) return -1;
        if(key_code!=27) /* esc sequence */
        {
#ifdef _DEBUG_VERSION
                printw(" %d ",key_code);
#endif
                return (gint32)key_code;
        }               
                
        key_code=getch();
        keystroke=key_code;
        key_code=getch();
        keystroke=keystroke | (key_code<<8);
        key_code=getch();
        keystroke=keystroke | (key_code<<16);

#ifdef _DEBUG_VERSION   
        printw(" %d %d %d ",(keystroke & 0xff),
                ((keystroke>>8) & 0xff),((keystroke>>16) & 0xff));
#endif  
        return keystroke;
}

On Thu, 2006-12-07 at 11:12 -0500, Bob Rossi wrote:
> Hi,
> 
> How does ncurses handle reading alt combinations from the keyboard?
> If the uesr types 'Alt-e', what does ncurses get from the terminal? Is
> this described in the terminfo database?
> 
> Thanks,
> Bob Rossi
> 
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses




reply via email to

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