How to make another keyboard for illume?

Carsten Haitzler (The Rasterman) raster at rasterman.com
Thu Dec 4 02:12:11 CET 2008


On Wed, 3 Dec 2008 17:14:22 +0100 "Thomas Seiler" <thseiler at gmail.com> babbled:

thanks thomas! :)
nb - mathieu - you were right that illume's OWN keyboard is internal. it's part
of the illume module - but if you select "another keyboard" for illume to run -
it will happily turn its own off and not use it at all and just run the
"external keyboard". as thomas said - it will start if for you (and kill it)
and manage the window's size, visibility based on focused application hints,
and send your window messages letting it know that the app may want certain
kinds of input :)

i will admit - i have this bad habit of writing mountains of code.. and
proceeding to never document them for human consumption. so u'll often have a
small universe of hidden/unknown features in stuff that i've put there... just
because "well that's the right way for it to work.. and be flexible and do much
more than it was ever designed to at the start"... but finding the stuff is an
adventure as it's buried somewhere in a small mountain of code :) i could write
documents (its nowhere near as fun and satisfying as writing code), but then i
wouldn't be making something newer/better :) ... so thanks very much to thomas
for 1. writing a test keyboard, 2. poking me to "fix it" and make sure it has
the stubs so you know how to do a kbd.

note - there is nothing limited to efl for doing a kbd. as long as:

1. can get x atoms (every toolkit can)
2. you cat set x properties on a window (every toolkit)
3. you can get x client messages (should be supported everywhere)

you can do a keyboard from illumes point of view. your real problem now comes
in "Sending" the keystrokes. this is up to you. illume/e provide no help. my
actual end desire was to also abstract this (maybe via stdout from the kbd app)
where you send a string or special keystroke thng to e and it handles
virtualising it and sending it to the app (however it can). this basically
removes a lot of x nasties from writing a vkbd and lets you focus on the kbd
itself (interacting with a user and filtering/correcting data before sending
as well as the ui of the kbd itself).

i haven't gotten to this.. yet... :)

> 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.


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com




More information about the devel mailing list