[PATCH weston] clients: Add XKB compose key support

Daniel Stone daniel at fooishbar.org
Thu Oct 6 12:06:42 UTC 2016


Hi,

On 6 October 2016 at 01:18, Bryce Harrington <bryce at osg.samsung.com> wrote:
> This adds single-symbol compose support using libxkbcommon's compose
> functionality.  E.g., assuming you have the right alt key defined as
> your compose key, typing <RAlt>+i+' will produce í, and <RAlt>+y+= will
> produce ¥.  This makes compose key work for weston-editor,
> weston-terminal, weston-eventdemo, and any other clients that use
> Weston's window.* routines for accepting and managing keyboard input.
>
> Compose sequences are loaded from the system's standard tables.  As
> well, libxkbcommon will transparently load custom sequences from the
> user's ~/.XCompose file.
>
> Note that due to limitations in Weston's key handler interface, only

*toytoolkit's

> @@ -3101,6 +3139,25 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
>                    state == WL_KEYBOARD_KEY_STATE_PRESSED) {
>                 window_close(window);
>         } else if (window->key_handler) {
> +               if ((sym != XKB_KEY_NoSymbol) &&
> +                   (state == WL_KEYBOARD_KEY_STATE_PRESSED) &&
> +                   (xkb_compose_state_feed(input->xkb.compose_state, sym) == XKB_COMPOSE_FEED_ACCEPTED)) {

Hm, this is kind of a hairy conditional.

> +                       switch (xkb_compose_state_get_status(input->xkb.compose_state))
> +                       {

Brace on same line.

> +                       case XKB_COMPOSE_COMPOSING:
> +                               sym = XKB_KEY_NoSymbol;
> +                               break;
> +
> +                       case XKB_COMPOSE_COMPOSED:
> +                               sym = xkb_compose_state_get_one_sym(input->xkb.compose_state);
> +                               break;
> +
> +                       case XKB_COMPOSE_CANCELLED:
> +                       case XKB_COMPOSE_NOTHING:
> +                               break;

CANCELLED should also produce NoSymbol, but NOTHING is fine to pass through.

Cheers,
Daniel


More information about the wayland-devel mailing list