bug-ncurses
[Top][All Lists]
Advanced

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

Re: reading shiftstate in xterm


From: Thomas Dickey
Subject: Re: reading shiftstate in xterm
Date: Sat, 23 Apr 2011 11:56:39 -0400 (EDT)

On Sat, 23 Apr 2011, frank wrote:

Hello Thomas,

Sorry if this is OT.

How can an ncurses based  C application read the
shift state of Ctrl from xterm?

Generally it can't.

xterm can be told to send most keys as escape sequences (using a control sequence "CSI > Ps; Ps m" that corresponds to the modifyOtherKeys resource). I haven't tabulated the possibilities for that, but essentially it tells xterm to send an 5 in the corresponding escape sequences. (Shift also is a modifier that could be sent as part of an escape sequence, but it is excluded as a special case for printable keys).

I suppose you could make a table of the responses you're looking for, and use define_key() to tell ncurses to interpret those results as function-keys. Otherwise, ncurses would see that as an unexpected escape sequence, and you'd just get the individual characters returned to wgetch.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



reply via email to

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