Deadkeys should not be linked to a specific key or key combo, but to an
ASCII value. It can be done something like this in the end of scan2asc()
(or whatever it's called - the function in keyboard.c that converts
scancodes to ASCII) (pseudocode):
/* ascii is the resulting ascii code after looking it up in the keyboard
table. */
if last_deadkey
{
if ascii in deadkey_base_characters(last_deadkey) /* E.g. o */
ascii = deadkey_accented_characters(last_deadkey, ascii) /* E.g ô */
else
ascii = last_deadkey
last_deadkey = '\0'
}
else if ascii in deadkeys /* E.g ^ */
{
last_deadkey = ascii
ascii = '\0'
}
return ascii
So if you set the character '^' to be a deadkey, then any key or
key-combo that returns ^ from the ordinary keyboard table will be a
deadkey. If a valid "base character" for this deadkey is pressed next,
it's corresponding accented character will be returned. E.g. ^ + o = ô.
If deadkey is followed by an invalid base character, the deadkey is
returned.