Branch
Hash :
7c4c718b
Author :
Date :
2024-09-30T06:13:38
Allow only the first group in symbols sections when using RMLVO Currently `xkb_keymap_num_layouts` may return a greater number than the number of layouts configured using RMLVO, because we allow symbols sections to define various groups per key. This is unintuitive and kind of buggy: groups should be added via rules by setting an explicit `:n` modifier. Fix: when parsing a keymap using RMLVO resolution: - Get the expected layouts count from the resulting KcCGST. - Drop the groups after the first one in included symbols sections. This will ensure that a symbol section can only define one group per key. Notes: - Compiling a keymap string directly is unaffected. - RMLVO resolution may still produce more groups than the input layouts. Indeed, some legacy rules in xkeyboard-config rely on this to insert automatically a US layout before the given non-Latin one, resulting in two layouts while only one was given.
// Define a key with various groups at the same time.
// Use RALT because the option `lv3:ralt_alt` used to have a similar
// (buggy) implementation, that triggered an unexpected result
// for `xkb_keymap_num_layouts` and `xkb_keymap_num_layouts_for_key`.
default partial modifier_keys
xkb_symbols "1" {
key <RALT> {
type[Group1]="ONE_LEVEL",
type[Group2]="ONE_LEVEL",
type[Group3]="ONE_LEVEL",
type[Group4]="ONE_LEVEL",
symbols[Group1] = [ a ],
symbols[Group2] = [ b ],
symbols[Group3] = [ c ],
symbols[Group4] = [ d ]
};
};
xkb_symbols "2" {
key <RALT> {
type[Group1]="ONE_LEVEL",
type[Group2]="ONE_LEVEL",
type[Group3]="ONE_LEVEL",
type[Group4]="ONE_LEVEL",
symbols[Group1] = [ a ],
symbols[Group2] = [ B ],
symbols[Group3] = [ C ],
symbols[Group4] = [ D ]
};
};