I'm currently trying to implement a virtual keyboard. For this to work I need to remap input events in all contexts.
I'm aware of the variables
function-key-map and it's siblings, as well as input methods. However, they all seem to be applied to a new key sequences, but not in the middle of a key sequence.
What I need is a way to convert some mouse events into key events. And this should work both at the beginning of a key sequence as well as in the middle of one.
Concretely, if the user clicks on my virtual key for 2, I want the digit
2 to be insert. However, if the user has typed C-x (either on a real keyboard or in my virtual keyboard) and click 2 on the virtual keyboard, I want the window to split (like C-x 2 normally do).
All suggestions on how to precede are welcome!