xkbcommon / libxkbcommon

keymap handling library for toolkits and window systems
https://xkbcommon.org
Other
286 stars 125 forks source link

Compose: allow overlapping sequences #398

Open wismill opened 1 year ago

wismill commented 1 year ago

Motivation

Currently xkbcommon does not support Compose overlapping sequences, unlike GTK and ibus. It means a sequence that is a prefix to a longer one is simply discarded with a warning.

This is unfortunate:

Proposed change

This commit introduces the new following API:

Fixes #395

NOTE: I intend to add the first two commits in #399. Will need to rebase once done.

Trying the patch

You can try it with

meson devenv -C build xkbcli-interactive-wayland --enable-compose --enable-compose-overlapping

or replace wayland with x11 if relevant.

Implementation in Qt

I asked feedback to Qt devs.

I sent also sent a merge request.

wismill commented 1 year ago

The idea is to create nodes that contain the overlapping results using a previously unused slot.

Possible enhancements:

It would be great to be able to test this in Qt apps to test the design, but I will not do it myself.

wismill commented 1 year ago

I asked feedback to Qt devs.

wismill commented 1 year ago

Not too happy with the XKB_COMPOSE_CANDIDATE_ACCEPTED state. But if we return just XKB_COMPOSE_COMPOSED, then the client should handle the last keysym as not part of the sequence.

wismill commented 1 year ago

I sent a merge request in Qt.