Implementing an on-screen keyboard

Daniel Drake dsd at laptop.org
Sat Nov 3 07:57:28 PDT 2012


Hi,

For OLPC/Sugar we have recently adopted Maliit, the Meego on-screen
keyboard. It is working great for areas where we have typical GTK+
widgets, because the on-screen keyboard (OSK) is able to synthesize
text input via the GTK+ Input Method mechanism.

However, there are also some other cases using weird UI libraries or
whatever where there is no interaction with GTK+ and/or GTK+ IM. For
such cases we would like to have the ability to pop-up the OSK
on-demand, then the user would type away on the OSK and things would
work as expected.

In this case, we would have no IM context available, so we need
another way of synthesizing the text input. What are the options here?

The one that comes to mind is to synthesize X keypresses, using XTest
or XSendKey. However, these both require keycodes, so they are limited
to keys that exist on the physical keyboard. And converting from
unicode to a keycode without hardcoding a table seems difficult.

I found a couple of attempts to overcome these limitations:
https://mail.gnome.org/archives/gnome-accessibility-list/2003-August/msg00111.html

Generate some unicode chars by synthesizing compose key sequences:
http://sourcecodebrowser.com/xautomation/1.03/multikey__map_8h_source.html

Neither of these seem particularly clean or solid.


I checked XI2 in the hopes that it might have modernized the keycode
concept (maybe it directly delivers unicode data?), but as far as I
can see it still limits itself to the old style keycodes.

Are there any clean options (or upcoming designs) to implement generic
"send the following unicode text input to the active window"
functionality, or have we hit a dead end for now?

Thanks,
Daniel


More information about the xorg mailing list