Re: yuhjklbn?



R. Alan Monroe wrote:
In article <slrndlrprh.cgl.thesheep@xxxxxxxxxxxxxxxxxxxx>, sheep1 % sheep.prv.pl wrote:

At 24 Oct 2005 18:28:29 -0700,
Kostatus wrote:


The arrow keys don't have diagonals at all.

But if you use the arrow keys on the numpad the diagonals are very intuitive and easy to use.

Especially on laptops. Not every keyboard has numpad either.


Hence the existence of handy USB numeric keypads. I bought one.

Alan


For what it's worth, I've had three different keyboards now
that actually *have* diagonal arrow keys.

And I don't know if there's any standard for it, but I think
that there is at least a strong convention for how it's implemented,
because all three use exactly the same binary interface.

A diagonal move on keyboards that actually have diagonal arrow
keys, as far as I can tell, is *always* encoded as four scancodes
in this order:

<LEFT-OR-RIGHT ARROW KEY_DOWN>
<UP-OR-DOWN ARROW KEY_DOWN>
<LEFT-OR-RIGHT ARROW KEY_UP>
<UP-OR-DOWN ARROW KEY_UP>

To produce the same sequence on your regular keyboard,
press the left or right arrow, then, while holding it down,
press the up or down arrow, then, while holding the up or
down arrow, release the left or right arrow, then finally
release the up or right arrow.

Unfortunately, if you use ncurses or similar to get keyboard
input, you don't get individual KEY_UP and KEY_DOWN scancodes;
you get just the KEY_DOWNs, and those translated directly into
characters.  So the sequence is indistinguishable from someone
pushing a left-or-right arrow and then pushing an up-or-down
arrow as a separate move.

So I never did anything with it.  ncurses is just too obvious a
choice, and it's not really compatible with the way ncurses
does things.



Things I'd like to do that ncurses doesn't easily allow...

Get keyrelease codes as well as keypress codes.
(I'd filter out most of them, but I'd keep the ones on arrow keys,
so I'd be able to tell the difference between diagonal and orthogonal
arrow movement commands)

Be able to tell whether an entered digit is on the keypad or the
number row.  (I'd like to be able to separate them so as to put
movement on the number pad and numbers-of-things on the number
row ... but I don't care much about this)

Check shift state explicitly when I get something that's not
normally affected by that shift state. (for example, I'd check
the alphabetic shift key or the control key when I get a digit
from the num pad, and use a "Run" action instead of a "walk"
action in that case)


Bear



.