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

can't add more than 4 layouts to the keymap #311

Closed
bam80 opened this issue Dec 13, 2022 · 3 comments
Closed

can't add more than 4 layouts to the keymap #311

bam80 opened this issue Dec 13, 2022 · 3 comments
Labels
X11 legacy: limitations Indicates a need to lift legacy X11 limitations

Comments

@bam80
Copy link

bam80 commented Dec 13, 2022

libxkbcommon/src/keymap.h

Lines 91 to 104 in 2530f64

/* This limit is artificially enforced, we do not depend on it any where.
* The reason it's still here is that the rules file format does not
* support multiple groups very well, and the rules shipped with
* xkeyboard-config (see rules/evdev) depend on this limit extensively.
* So just lifting this limit would cause problems for people who will use
* more than 4 layouts.
* TODO: Fix the group index syntax in the rules format, preferably in a
* backwards compatible way.
* See e.g. https://bugs.freedesktop.org/show_bug.cgi?id=14372
* Note: A limit on the number of groups we *do* depend on is imposed by
* the size of the xkb_layout_mask_t type (32). This is more than enough
* though.
*/
#define XKB_MAX_GROUPS 4

This limit is artificially enforced

It's not documented anywhere, which is an issue per se I already faced, and also it might be useful to add more layouts for example as in our KDE KWin's unit tests (I'll provide the link).
@bluetech

@whot
Copy link
Contributor

whot commented May 2, 2023

Realistically, the main limitation here is XKB. The XKB protocol (the X11 bit) has the limit of 4 groups hardcoded, so if we want to stay compatible to that (and we do, for the forseeable future) extending this is not an option.

A quick peek of the protocol indicates only XkbGetMap has that actually as a sized limit (ktIndex is limited to 4 groups), afaict everything else could make use of at least 256 or (as in that comment) 32 where used as mask. But XkbNumKbdGroups has been #defined to 4 for decades now and I'm sure there is plenty of code out there that hardcodes it. the protocol also defines KB_GROUPMASK as 1-4 groups, so extending this will also cause issues.

@bam80
Copy link
Author

bam80 commented May 2, 2023

Could we make it opt-in maybe? Because right now we already faced with the real issue above due to the limitation, which needs to be solved anyway.

@wismill
Copy link
Member

wismill commented Jul 12, 2024

Duplicate of #37, let’s continue the discussion there as it has more info.

@wismill wismill closed this as completed Jul 12, 2024
@wismill wismill mentioned this issue Jul 12, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
X11 legacy: limitations Indicates a need to lift legacy X11 limitations
Projects
None yet
Development

No branches or pull requests

3 participants