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

Capital transformation for multiple keysyms #552

Open
wismill opened this issue Dec 13, 2024 · 0 comments
Open

Capital transformation for multiple keysyms #552

wismill opened this issue Dec 13, 2024 · 0 comments
Labels
keysyms state Indicates a need for improvements or additions to the xkb_state API

Comments

@wismill
Copy link
Member

wismill commented Dec 13, 2024

2a2a8d7 introduced the handling of Caps and Control keysyms transformations.

However, it works only for xkb_state_key_get_one_sym, but not for xkb_state_key_get_syms:

Also, only xkb_state_key_get_one_sym() is changed;
xkb_state_key_get_syms() is left as-is, and always reports the
untransformed keysyms.

I would like to revisit this decision:

This is for the following reasons:

  • The API doesn't allow it, since we return a const pointer directly to
    the keymap keysyms table and we can't transform that.

We could use an internal buffer, such as for the Compose iterator (see xkb_compose_table_iterator::entry). As we discussed in #300, xkb_state is not meant to be thread-safe.

  • The transformation doesn't make sense for multiple-keysyms.

I disagree: it feels quite a counter-intuitive result.

  • It can be useful for an application to get the "raw" keysyms if it
    wants to (e.g. maybe it wants to do the transformation itself).

This is a valid point. But note that they are always available with xkb_keymap_key_get_syms_by_level.


I see 2 directions:

  1. Change the current API to support Caps transformation and use an internal buffer. This is a obviously a breaking change. Potential issue: we do not constraint the keysyms count, so what size should the buffer have?
  2. Add a new API xkb_state_key_get_syms2 with a flag to set which transformation should be performed. We should probably let the user provide the keysyms buffer, much like xkb_state_key_get_utf8. Note that as stated above, we do not constraint the keysym count, so we should provide a feedback in case the buffer is too small.

Option 2 seems the safest.

@wismill wismill added state Indicates a need for improvements or additions to the xkb_state API keysyms labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keysyms state Indicates a need for improvements or additions to the xkb_state API
Projects
None yet
Development

No branches or pull requests

1 participant