Skip to content

Conversation

@wismill
Copy link
Member

@wismill wismill commented Nov 20, 2025

Enable to apps to query the version of the libxkbcommon library actually in use and adapt their behavior: e.g. supported flags and available symbols, etc.

Fixes #932


TODO:

  • Better commit message
  • Documentation with examples (do and don’t)
  • Changelog
  • Add a flag arg to enable future developments?

Enable to apps to query the version of the libxkbcommon library
actually in use and adapt their behavior.
@wismill wismill added this to the 1.14.0 milestone Nov 20, 2025
@wismill wismill requested review from bluetech and whot November 20, 2025 11:56
@wismill
Copy link
Member Author

wismill commented Nov 20, 2025

@bluetech @whot See #932 for the rationale. My main reluctance for this function is that it can be abused or the app workaround get out of sync, while testing failures could be a more robust solution (e.g. unsupported flags1, etc.).

Footnotes

  1. Note that xkb_context_new() currently does not fail on invalid flags. Probably worth fixing.

@Caellian
Copy link

Caellian commented Nov 20, 2025

I will go with symbol testing in the end for what I need. I see xkb_get_version as something useful only if functions like xkb_keymap_is_supported_format, xkb_context_is_flag_supported, etc. are missing for functionality that can't be probed through symbols or require e.g. constructing context+keymap+state to check whether something is supported.

Wayland allows requesting specific protocol versions, so I guess this would simplify some cases the same way it helps with protocol versioning in WL. But I agree now that it's bad to rely solely on version to handle all version differences in the library because that requires the app/bindings/wrapper to stay on top of all the changes to this library.

There's potential for misuse, but it could also pad omissions and mistakes. I suggest you mention in the docs "prefer other means (e.g. checking symbols) instead of relying solely on this value if possible".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add version query method (xkb_get_version)

2 participants