Keymap: add support for querying supported formats #484
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.
In #446 I experimented introducing new syntax, which makes the MR backward incompatible.
I think it is due time that we add support for new keymap formats, in order to solve 20-years old issues. There are two issues:
What makes #446 break compatibility? It introduces new options that circumvent the XKB limitations by adopting alternative behavior for the locks, thus incompatible with the official protocol.
Now, I realized that:
xkeyboard-config
files could be used unchanged, the newer format fixing automatically the old issues by using the proper defaults.XKB_KEYMAP_FORMAT_TEXT_V1
format and parsed it. In a nutshell:XKB_KEYMAP_FORMAT_TEXT_V1_1
(new format): new syntax, new defaults.XKB_KEYMAP_FORMAT_TEXT_V1
(old format)XKB_KEYMAP_FORMAT_TEXT_V1
as usual.I replaced #446 by #485, based on these observations.
So while bringing keymap format version negotiation in Wayland would allow for more evolution, we do not need it right now, because it can be done internally in the Compositor.
Now, the Compositor need to know what keymap formats are supported. Currently the various
keymap_new_from_*
functions reportNULL
if the format is not supported, but also for a variety of other reasons. So I propose to add the following API:xkb_keymap_supported_formats
: returns an array of supported versions (currently of size: 1).xkb_keymap_is_supported_format
: predicate to check a specific version.xkb_keymap_new_from_names2
: a variant ofxkb_keymap_new_from_names
that allow to specify the keymap format. It looks that the missingformat
argument was an oversight, because all the otherxkb_keymap_new_from_*
do have it.TODO: