[AD] patch for pckeys.c and unicode.c

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


Hello everybody...

I'm sending two patches...

Some time ago, I started a small thread about keyboard mapping (especially
about the 'unmappable' Slovak keyboard :-) and came up with an idea how to
modify the current accent mapping system. And now (sorry for the delay,
but I had no time for programming, you know, the school...) the results :

I rewrote the use of accents in national keyboard layouts. Now it supports
four different accent escape keys (when I say different, I mean different :-)
Each of the accent keys has an activation flag, which can be 0 (when no 
additional key has to be pressed to activate the accent), 1 for SHIFT,
2 for CONTROL and 3 for ALT (the Slovak keyboard uses even AltGr :-).
I thought it wouldn't harm anything if this accent activates even through
the left ALT key...

That means, you can map one single key to all four accents, or four different
keys, or whatever you want. So the accent mapping system is compatible
with such "exotic" mappings as the Slovak mapping (also fully compatible
with the old mappings, after a little modification of them - see below).

Because of the use of AltGr in the Slovak mapping (well, it is probably
the only mapping in the whole world that uses AltGr for an accent escape
key :-) I removed the section which overrides the accent escapes when
pressing AltGr.

There is some change in the structure of the .cfg files for the mapping.
In the [key_escape] section there are accent1, accent2, accent3, accent4
and accent1_flag, ..., accent4_flag (the activation flags). Then, the
mapping sections are [key_accent*_upper] and [key_accent*_lower].

Of course, I modified all other current mappings to be compatible with this
new system and modified the keyconf utility to be able to edit and test the
new accents.

--------

The next thing I'm sending is a patch to unicode.c, which corrects the
conversion to ASCII_CP. The previous version did not convert characters from
other than 1st unicode page, so the allegro_message(...) returned weird stuff
on the screen ('^' instead of 'correct' (similar) characters). So I
added the second unicode page characters to the codepage_extras table
(see the attachment) in unicode.c and now it works perfectly.

I also made a very very small change to the docs. In the section KEYBOARD
ROUTINES, subsection KEY_SHIFTS, I just replaced the KEY_ACCENT1_S_FLAG and
KEY_ACCENT2_S_FLAG with the new flags. Then, in the section which describes
the switch_modes I replaced SWITCH_PAUSED with the correct SWITCH_PAUSE.

In the attachment there is a zip file with the diff file (see readme) and
the new keyboard.dat. I used the diff utility for the first time, so in
case of an error (should not happen, but who knows ...) I placed a zip file
with the modified files to my homepage (see the signature below).

The modified files are :  docs/allegro._tx
			  include/allegro.h
                          include/allegro/aintern.h
                          setup/keyconf.c
                          setup/keyconf.txt
                          src/misc/pckeys.c
                          src/unicode.c

								      Peter

BTW...Why doesn't the example exkeys.c use ureadkey instead of readkey ?
If there is a character with the value above 255 in the loaded keyboard
mapping, it won't display it...


-- 
------------------------------------------------
Mail: pavlovic@xxxxxxxxxx
WEB : http://redbull.dcs.fmph.uniba.sk/~pavlovic
------------------------------------------------

Attachment: patch.zip
Description: Zip compressed data



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