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

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


On Sun, 2004-06-06 at 15:56, Peter Wang wrote:

> 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;

I agree. I think the keyboard model used by SDL is better. For unknown
keys, e.g. "ß" on my keyboard, KEY_UNKNOWN1 could be used (or anything
else - since the only use would be to read it in response to user input,
but never to hardcode it).

> - don't use pckeys.c layer;

At least OSX and unix console already do that (maybe even X11 is the
only non DOS/Windows port to use that funny triple lookup from
X11-keycode to PC-scancode to Allegro keycode to ASCII).

> - 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.
> 

Yes, just what I think. [u]readkey() would return "ß" when I press that
key - without needing any lookup tables. And XLookupString surely must
handle unicode, at least, running xev, it says:

KeyPress event, serial 27, synthetic NO, window 0x3800001,
    root 0x48, subw 0x0, time 2955921, (390,317), root:(398,392),
    state 0x80, keycode 26 (keysym 0x20ac, EuroSign), same_screen YES,
    XLookupString gives 3 bytes:  "€"

So pressing AltGr+e returns 3 bytes for "€", which must be unicode
0x20ac encoded as UTF8.

All we need now is someone who wants to do the rewrite, which should
hopefully shorten the X11 code a bit, and make it possible to distribute
X11 programs without users requiring to run xkeymap in order to get
working keyboard input :)

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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