Re: [AD] XIM patch for Allegro 4.1.x |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
On Sat, 2004-11-20 at 21:52 +0100, Elias Pschernig wrote: > Er, here is the patch. Hm, and already another. This time it is tested in X11 and Windows. I made a new patch containing the previous one, and also the one before. (In case someone wants to try it, it's easier to just apply it all at once I guess.) The things I changed: Minor things that I think I can just apply: - pckeys isn't linked into the X11 version anymore - no more key[0] presses are possible - the set_locale and french numbers issues - adding 8 KEY_UNKNOWN keys to be used in X11, which else runs out of keys on my 123 keys keyboard - scancode_to_ascii now works at least for a few keys even if the keyboard driver doesn't implement it (X11 and OSX, probably also linux console, didn't check yet) More serious changes: - new function: char const *scancode_to_name(int scancode); The reason for it was mentioned in this thread. It is most common in games to let the user choose keyboard assignements, and therefore key names need to be displayed. So far, this worked by using a combination of an array with strings of all they KEY_* names (like in exkeys), and scancode_to_ascii. Whenever scancode_to_ascii would return 0, the KEY_* key string was used instead. This worked quite well - but still isn't the most clean solution. And in the case of X11, I couldn't find a way to make scancode_to_ascii work for all keys (e.g. ^ ' # + ö ä ü ß < with a german layout). So, I propose this new function, which will supercede scancode_to_ascii. It will return a pointer to a static string with the name of a key. For most keys this will be just the same as scancode_to_ascii, but it will work for every key, i.e. also keys like F1..F12, Enter, Tab, Shift, Control and so on. So a keyboard configuration now just needs to use this function, and will display localized string names. In X11, it's implemented with KeysymToString, in pckeys based drivers it just works like the method users had to do manually with scancode_to_ascii before. - updated exkeys to demonstrate keyboard_lowlevel_callback and scancode_to_name -- Elias Pschernig
Attachment:
keys2.diff.gz
Description: GNU Zip compressed data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |