[comp.windows.x] keycodes

roseal@sequent.UUCP (Rose Alford) (06/07/90)

Is there a convention that each key on a keyboard has a unique keycode?  Can
one assume this is true?  Is there any advantage for two different keys (such
as the right and left shift keys and the right and left Alt keys) to have the
same keycode?  What if you wanted to use the right Alt key for a different
purpose than the left one?  It seems to be a limitation.  I am using a
keyboard that has this problem now, after the server was upgraded.  What is
the current thinking (if any) on this?  

--roseal

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (06/07/90)

    Is there a convention that each key on a keyboard has a unique keycode?

Every key should have a unique keycode, unless the hardware does not permit
them to be distinguished.  I suppose there might be some other reason to
assign identical keycodes, but I don't think I've heard any.

klein%ncd@UUNET.UU.NET (06/07/90)

>Is there a convention that each key on a keyboard has a unique keycode?  Can
>one assume this is true?  Is there any advantage for two different keys (such
>as the right and left shift keys and the right and left Alt keys) to have the
>same keycode?  What if you wanted to use the right Alt key for a different
>purpose than the left one?  It seems to be a limitation.  I am using a
>keyboard that has this problem now, after the server was upgraded.  What is
>the current thinking (if any) on this?  

I assume by your mail that you are using an NCD, and the upgrade you are
referring to is 2.1. To go back to the way the keyboard is 'supposed to be'
you must turn off a 'feature' of our 2.1 server that was added for DECwindows
compatibility. In the SETUP menus there is a button called 'DW Compatibility'.
Make sure it says 'No'. One of the side effects of saying 'Yes' is to cause
several of the 'right' keys, (e.g., Alt, Shift), to 'disappear'. See earlier
postings by myself and Burns Fisher of DEC for technical details if you are
curious.


Doug 
klein@ncd.com

jg@zorch.crl.dec.com (Jim Gettys) (06/07/90)

Each key on the keyboard "should" have a unique keycode, but there is no
guarantee.  For example, on the DEC LK201 keyboard (designed long before
X), you can't tell left shift from right; this is inherent in the
hardware, and cannot be worked around.  The LK401 which we recently
started using on the VT1000 can.  But you can't assume you can
distinguish all keys, and there is no advantage for keycodes to be
shared between keys.  Keyboards should also always report up
transitions properly, and my experience is that implementation of autorepeat
is best left to driver software.  Many keyboards attempt to be too "smart" for
their own good, and end up getting in the way.  So while X is designed
presuming reasonable keyboards, it was not possible to require all
keyboards conform at the time we were designing X.

Another common problem is that some people's keyboards can't report up
transitions on non-modifier keys at all times (or don't due to software
limitations, like the current Ultrix drivers which can't do both
autorepeat and up/down simultaneously; I've fixed this in the
multi-screen driver which will start appearing later this year on our
RISC machines).  

There may also be limitations on what keys can be modifiers (true again
in current Ultrix software, and again fixed in my new driver, which
works as well as the hardware can possibly be used, by telling the
keyboard to do as little as
possible for my "benefit"). 

In general, X asks for "correct" keyboards, but many currently on the
market are inadaquate either due to hardware problems or driver
problems, and so software implementers had better be more careful on
keyboard usage than anywhere else in X.
I use my own company's products only as an example; I have reason to
believe that we are typical of what is on the market today (and we are
fixing as many problems
as possible).

				- Jim

) (06/12/90)

In article <9006071445.AA09751@bryant.com> klein%ncd@UUNET.UU.NET writes:
>
>>Is there a convention that each key on a keyboard has a unique keycode?  Can
>>one assume this is true?  Is there any advantage for two different keys (such
>>as the right and left shift keys and the right and left Alt keys) to have the
>>same keycode?  What if you wanted to use the right Alt key for a different
>>purpose than the left one?  It seems to be a limitation.  I am using a
>>keyboard that has this problem now, after the server was upgraded.  What is
>>the current thinking (if any) on this?  


What i'd love to know is if you can assign a sequence of key codes to
one key, so that you could say, use jove and assign "funky" commands to
"funky" keys.

-thanks

-charles

cyj9h@Virginia.EDU