Compose: allow overlapping sequences#398
Draft
wismill wants to merge 1 commit into
Draft
Conversation
Member
Author
|
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. |
Member
Author
|
I asked feedback to Qt devs. |
Member
Author
|
Not too happy with the |
wismill
force-pushed
the
compose/allow-overlapping-sequences
branch
2 times, most recently
from
November 4, 2023 20:27
95e8b5b to
8f8d656
Compare
wismill
force-pushed
the
compose/allow-overlapping-sequences
branch
from
November 6, 2023 20:19
8f8d656 to
bbb3ca7
Compare
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:
- There is discrepency for users of xkbcommon, e.g. Qt-based apps.
- It is impossible to have a sequence that is the prefix of another one.
As a consequence, if one imports e.g. the system locale Compose file
(as many – most ? – custom Compose files do), some sequences become
impossible.
Example: I used `<Multi_key> <minus> <period> : "•" U2022` but
upstream change in libX11 added `<Multi_key> <minus> <period> <e> : "ė̄"`,
so I had to introduce an alternative sequence for Qt apps, although
the previous one works in GTK-based apps.
This commit introduces the new following API:
- Macro `XKB_COMPOSE_HAS_OVERLAPPING_SEQUENCES_SUPPORT` to test
overlapping sequences support at compile time via `#ifdef`.
- `xkb_compose_compile_flags`:
`XKB_COMPOSE_COMPILE_OVERLAPPING_SEQUENCES`: Allow overlapping sequences
- `xkb_compose_status`:
- `XKB_COMPOSE_CANDIDATE`: A complete sequence has been matched, but
a longer sequence also exists.
- `XKB_COMPOSE_CANDIDATE_ACCEPTED`: The last sequence was accepted
due to an unmatched keysym.
wismill
force-pushed
the
compose/allow-overlapping-sequences
branch
from
November 6, 2023 20:42
bbb3ca7 to
ab79706
Compare
Member
Author
|
I sent a merge request in Qt. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
There is discrepency for users of xkbcommon, e.g. Qt-based apps.
It is impossible to have a sequence that is the prefix of another one.
As a consequence, if one imports e.g. the system locale Compose file
(as many – most ? – custom Compose files do), some sequences become
impossible.
Example: I used
<Multi_key> <minus> <period> : "•" U2022butupstream change in libX11 added
<Multi_key> <minus> <period> <e> : "ė̄",so I had to introduce an alternative sequence for Qt apps, although
the previous one works in GTK-based apps.
Proposed change
This commit introduces the new following API:
XKB_COMPOSE_HAS_OVERLAPPING_SEQUENCES_SUPPORTto testoverlapping sequences support at compile time via
#ifdef.xkb_compose_compile_flags:XKB_COMPOSE_COMPILE_OVERLAPPING_SEQUENCES: Allow overlapping sequencesxkb_compose_status:-
XKB_COMPOSE_CANDIDATE: A complete sequence has been matched, buta longer sequence also exists.
-
XKB_COMPOSE_CANDIDATE_ACCEPTED: The last sequence was accepteddue to an unmatched keysym.
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
or replace
waylandwithx11if relevant.Implementation in Qt
I asked feedback to Qt devs.
I sent also sent a merge request.