Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keymap: add support for querying supported formats #484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wismill
Copy link
Member

@wismill wismill commented Jul 4, 2024

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:

  1. Handle version negotiation: this is the purpose of this MR.
  2. Handle backward-incompatible formats: this is the blocker of Experimental: Add XKB extension for locks #446.

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:

  1. A new format could set default values for the new options, that would make them implicitly opt-in. In order to get back the standard XKB behavior, one would have to explicitly opt-out. In a nutshell, it means that the current xkeyboard-config files could be used unchanged, the newer format fixing automatically the old issues by using the proper defaults.
  2. Only the Wayland compositor needs to use this new format to fix the issues: the clients will receive the corrected events for group/mods changes, although they retrieved the old XKB_KEYMAP_FORMAT_TEXT_V1 format and parsed it. In a nutshell:
    • Compositor parses the keymap using XKB_KEYMAP_FORMAT_TEXT_V1_1 (new format): new syntax, new defaults.
    • Compositor updates the state according to the new options; it may circumvent XKB spec to fix old issues.
    • Compositor serializes the keymap using XKB_KEYMAP_FORMAT_TEXT_V1 (old format)
    • Clients process the keymap using 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 report NULL 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 of xkb_keymap_new_from_names that allow to specify the keymap format. It looks that the missing format argument was an oversight, because all the other xkb_keymap_new_from_* do have it.

TODO:

  • Changelog entries

@wismill wismill force-pushed the keymap/versioning branch 2 times, most recently from 8666ff2 to e027955 Compare July 4, 2024 18:06
Add the following API:
- `xkb_keymap_supported_formats`
- `xkb_keymap_is_supported_format`
Currently `xkb_keymap_new_from_names` does not allow to specify the
keymap format, so provide a new function `xkb_keymap_new_from_names2`.
@wismill wismill mentioned this pull request Jul 5, 2024
2 tasks
@wismill wismill added enhancement Indicates new feature requests compile-keymap Indicates a need for improvements or additions to keymap compilation labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile-keymap Indicates a need for improvements or additions to keymap compilation enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant