Re: [AD] From AL: Dead keys in allegro/mandrake

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Christer Sandberg wrote:

On Saturday 05 June 2004 10.25, Elias Pschernig wrote:
Now, we leave X11, and those Allegro PC HW scancodes are passed on to
the DOS/windows keyboard handling, which does another mapping from
scancodes to Allegros KEY_* codes, and those are used to get the
I think it is correct to name at most one of the two codings `scancode'. Unfortunately docs and examples names the latter one scancodes and also in some places in the source (variable names comments etc. in e.g. keyboard.c). The former coding is also called scancode in the source (in e.g. xwin.c). I guess that `pc-hw' is the one that should be the real scancode, if I remember right it was in that context it was used. People that knows about that might be confused when reading Allegro docs. If changing the docs, people that has learn by using Allegro might be confused. People that reads the sources will get confused anyway... I know that for sure.
Hmm, don't know what would be the best to do about this.

I think 'scancode' should be reserved for the codes produced by the keyboard hardware, and emulations thereof (i.e. pckeys.c). Allegro's KEY_* constants can be named 'keycodes'.

Internally, platform-specific codes can be called "X keycodes", etc. This is just to reduce confusion for people reading the source code though.

Another confusing thing (that has nothing to do with the X-problem) is
the KEY_* names. Obviously KEY_A don't mean "the key with an A on" but instead "the key in the upper leftmost corner among the letter keys". So names that associates with this would be less confusing, e.g. KEY_LETTER_ROW1_1, KEY_LETTER_ROW1_2 etc. But it is not simple to define the term "letter keys", the keys that have letters varies, depending on language layout, and the names of other keys are not very good either, e.g., KEY_EQUALS is not good to me because the '=' is on shift-0. It would on the other hand also be a bit stupid to name things like KEY_LETTER_ROW1_1 (matrix index...), so maybe just use a sequential numbering (e.g. keeping the one that exists) and in the docs present a keyboard layout that shows the numbering (developers that want to use acronyms can do their own, national specific or not)?

The current system seems to be the best compromise. I assume most people know roughly what a US ASCII keyboard looks like, so KEY_EQUALS tells you *roughly* where the key would be, better than KEY_62.

If you want sequential numbering, you can [almost] use it already -- just write bare integers instead of KEY_*. Strictly speaking, you'd need a guarantee that the KEY_* values won't change in future versions.


PS. I pretty much agree with scrapping the X keyboard code.  Under X:
- just don't bother to try and match the KEY_* codes to physical keys;
- don't use pckeys.c layer;
- readkey() should just return whatever characters that XLookupString(xke, ...) where xke is the XKeyEvent given to us by the X server. This will only work for Latin-1 characters.


cheers,
Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/