[maemo-developers] No key events for virtual keyboard?

From: Martin Grimme martin.grimme at gmail.com
Date: Fri Jan 9 14:30:18 EET 2009
Hi,

the GTK editing widgets in maemo are modified to receive the key codes
(or rather UTF-8 strings) from the VKB. The VKB does not send normal X
key events (except for Enter and Backspace).
The GTK input widgets don't emit a key-event or changed-event per VKB key.
You can connect to the "commit" signal of the GTKIMMulticontext to
receive key by key.

Here's an example (in Python, calling the C-libraries directly, so it
should be portable almost 1:1):

https://garage.maemo.org/plugins/scmsvn/viewcvs.php/trunk/utils/hildon_input_method.py?revision=556&root=mediabox&view=markup

(replace hash(win.window) with the pointer to your GdkWindow in C)

You can open the VKB for your application's toplevel window this way
and receive all key events. However, be warned that if your
application relies on GDK_POINTER_MOTION_HINT_MASK, the VKB will break
pointer motion event detection badly!
If you don't have to rely on the hint mask, it's all OK.


Regards,
Martin


2009/1/9, Eero Tamminen <eero.tamminen at nokia.com>:
> Hi,
>
> ext Till Harbaum / Lists wrote:
>> i have just ported "tetrinet for linux" to maemo. You can get this from
>> the extras
>> repository. While this works well on the n810's physical keyboard it
>> doesn't work
>> with the virtual keyboard (neither on my n800 running chinock nor an the
>> n810
>> running diablo).
>>
>> The problem is that all keyboard handling is being done by the original
>> "tetrinet for linux"
>> code and my maemo gui just forwards all key presses there and updates the
>> gui on
>> the returning function calls from the original code. Thus i have installed
>> a "key_press_event"
>> handler which then feeds all key presses into the tetrinet engine.
>> Unfortunately the
>> virtual keyboard doesn't generate events. Or to be precise: It does, but
>> for some reason
>> only for the Enter key.
>>
>> How comes? Can i somehow get access to all key presses from the virtual
>> keyboard?
>
> VKBD sends the events as X messages to the Gtk editing widget
> (i.e. something having Gtk IM context) that has the focus.
>
> Apparently it still synthetizes couple of keys (apparently Enter
> and maybe Backspace) as normal X key events, but that doesn't work
> for all keys (X key events cannot represent all unicode characters).
>
>
>> If you ever tried mtetrinet on the n800 or on the n810 with the virtual
>> keyboard you'll
>> find that you can in fact enter things into the entry fields. But these
>> don't enter my keyboard
>> routine but instead "magically" appear directly in the entry field. This
>> means that the tetrinet
>> engine underneath never saw these key presses and thus ignores them even
>> though they
>> show up in the entry. Thus you e.g. can't type anything in the "partyline"
>> which limits
>> the functionality pretty much.
>
>
> 	- Eero
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

More information about the maemo-developers mailing list