[PATCH 00/15] Hardware keyboard input for input methods

Kristian Høgsberg hoegsberg at gmail.com
Thu Nov 8 13:53:15 PST 2012


On Mon, Nov 05, 2012 at 03:26:38AM +0100, Jan Arne Petersen wrote:
> From: Jan Arne Petersen <jpetersen at openismus.com>
> 
> Hardware keyboard input allows input methods to grab the keyboard
> and process hardware key events to generate text events (with
> pre-edit) over the same text_model interface we use for the virtual
> keyboard. This allows input methods which compose multiple key
> events for inputting text like it is done for CJK languages.
> 
> There is a weston-simple-im which uses the hardware keyboard input
> to support classic X compose key like combinations:
> http://en.wikipedia.org/wiki/Compose_key#Common_compose_combinations
> 
> It makes allot of sense to reuse the wl_keyboard interface in the
> input_method_context grab_keyboard request. But I am not so sure about
> the wl_keyboard interface used in the get_keyboard request in
> text_model. Maybe it would be better to merge the key event from 
> wl_keyboard into text_models keysym event and just add also keymap
> and modifiers event to text_model.

> Jan Arne Petersen (15):
>   editor: Fix handling of UTF-8 text
>   editor: Initalize editor struct with 0
>   editor: Remove preedit text on startup
>   keyboard: commit preedit before sending key events
>   keyboard: Rename keyboard to weston-keyboard

This looks good and I've committed these first 5 patches.

>   text: Start input method from configuration

I'm happy to see this functionality land, but there's few comments on
the patch.

>   text: Rename and extend text_model key event

I'm holding off on this one and the remaining patches.  I think you're
right that it's better to just add the events to text_model, but
there's more to it than that.  We need a better approach to modifiers
than what you have in the keysym event.  It needs to be compatible
with the wl_keyboard modifier model.  That's a bitmask too, but you
need the xkb keymap to understand what the bits mean
(xkb_map_mod_get_index).  So we could add a keymap event to
text_model, but it's a little expensive to send out and re-parse the
xkb map, so I'd rather the text_model could grab it from the
associated wl_keyboard (from wl_seat in text_model.enter).  I'd also
rather use a modifier event like wl_keyboard than send the modifiers
with each keysym event.

Now if we use the keymap from the associated wl_seat, have a modifier
event and the keysym event, do we still need text_model.get_keyboard?
Do we ever need the key codes at this level?  And if we do, can we
just get them from the real wl_keyboard?  That is, send out the
keycode from wl_keyboard interface and the keysym from text_model?

Hmm, and if we rely on wl_keyboard in text_model (for the keymap)
should we just get modifier events from wl_keyboard as well?  That is,
we only add the keysym event to text_model and keymap and modifiers
come from the underlying wl_keyoard.

Kristian

>   text: Add support for grabbing the keyboard
>   text: Add get_keyboard to text_model
>   text: Add seat argument to text_model enter event
>   text: Add support for forwarding key events
>   window: Add utils for xkb keyboard input
>   window: Allow to get xkb context from display
>   editor: Add support for hardware key events
>   text: Add simple compose input method
> 
>  clients/.gitignore         |   3 +-
>  clients/Makefile.am        |  20 ++-
>  clients/editor.c           | 236 ++++++++++++++++++++++++++++---
>  clients/keyboard-utils.c   | 173 +++++++++++++++++++++++
>  clients/keyboard-utils.h   |  67 +++++++++
>  clients/keyboard.c         |  72 +++++++---
>  clients/weston-simple-im.c | 338 +++++++++++++++++++++++++++++++++++++++++++++
>  clients/window.c           |   6 +
>  clients/window.h           |   3 +
>  protocol/input-method.xml  |  32 +++++
>  protocol/text.xml          |  23 ++-
>  src/compositor.c           |   2 +-
>  src/compositor.h           |   4 +-
>  src/text-backend.c         | 267 +++++++++++++++++++++++++++++++++--
>  weston.ini                 |   3 +
>  15 files changed, 1188 insertions(+), 61 deletions(-)
>  create mode 100644 clients/keyboard-utils.c
>  create mode 100644 clients/keyboard-utils.h
>  create mode 100644 clients/weston-simple-im.c
> 
> -- 
> 1.7.11.7
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list