How to make another keyboard for illume?

Thomas Seiler thseiler at gmail.com
Wed Dec 3 17:14:22 CET 2008


Hi Mathieu,

On Wed, Dec 3, 2008 at 3:47 PM, Mathieu Rochette <mathroc at gmail.com> wrote:
> As I write some time ago, I'm planning to develop a "dasher-like"
> keyboard for illume for a school project. And I'm beginning right now.

Great to hear that, and good luck.

> But I'm not sure I understand well how things are done. I think that,
> for now, there is no easy way to make different virtual keyboard and
> switch between them.

Actually, illume can already handle different keyboards, and also
switch between them.
Raster did really a great job here. Unfortunately, it is all still a
bit undocumented.

So here is what you need to get started:

1) Your keyboard needs a .desktop file in /usr/share/applications, and
in there you have to set the Categories to "Keyboard":

| Categories=Keyboard;

This will make illume understand that this app is in fact a keyboard.
It will hide the icon on the
home screen, and instead will display the app as an additional choice
in the Configuration -> Keyboards Dialog.
And it will take care to auto-start the keyboard at the beginning of
the session.

2) Your keyboard's window needs to set some hints, so that illume can
recognize it as a virtual keyboard

| /* set this window up to be a virtual keyboard window */
| {
|	Ecore_X_Window_State states[2];
|
| 	/* tell e to skip this window in the pager and taskbar/winlist etc. */
| 	states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
| 	states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
| 	ecore_x_netwm_window_state_set(ecore_evas_software_x11_window_get(ee),
states, 2);
| 	/* tell e that this is definitely a vkbd window */
| 	ecore_x_e_virtual_keyboard_set(ecore_evas_software_x11_window_get(ee), 1);
| 	/* for point 3): ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, client_message_handler, ee); */
| }

This will allow illume to auto-show and hide your window whenever the
user clicks on the QWERTY button or
some widget is focussed that supports the illume keyboard show/hide mechanism.

If you do not use the efl to write your keyboard, you will have to dig
trough the ecore source to understand the
names of the properties on the X11-level.

Note that your keyboards window cannot be a x-shaped windows or a
fullscreen window.

3) Make your keyboard understand the nature of the thing that is about
to be entered, and let it adapt itself:

| int client_message_handler(void *data, int type, void *event)
| {
| 	Ecore_X_Event_Client_Message *ev = event;
|
| 	/* if the message type is a keyboard state... */
| 	if (ev->message_type == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
| 	{
| 		/* handle the various keyboard types */
| 		switch (ev->data.l[0])
| 		{
| 			case ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF:      ... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON:        ... break;
| 			case ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA:    ... break;
| 			case ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC:  ... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN:       ... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER: ... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX:	... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL: ... break;
| 			case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD: ... break;
| 			default:
| 		}
| 	}
|
| 	/* return 1 to allow this event to be passed on to other handlers */
| 	return 1;
| }

As an example how all this works together, we have written a simple
example keyboard, code is here: http://svn.om.vptt.ch/trunk/test-keyboard/

The tutorial that should explain all this is still unfinished, and
will need a bit more time...
In the meantime, i hope this email helps...

Cheers,
Thomas

PS: You might also want to check out the simple character recognizer:
http://svn.om.vptt.ch/trunk/scr/ & http://www.om.vptt.ch/site/?p=382


-- 
Excercise 17:
If the human brain was simple enough for us to understand we'd be so
simple we couldn't understand.
Prove this by induction.



More information about the devel mailing list