-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
13 changed files
with
278 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
`xkb_keymap_new_from_names`: Allow only one group per key in symbols sections. | ||
While the original issue was [fixed in `xkeyboard-config`](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/253) | ||
project, the previous handling in `libxkbcommon` of extra key groups was deemed unintuitive. | ||
|
||
Note: rules resolution may still produce more groups than the input layouts. | ||
This is currently true for some [legacy rules in `xkeyboard-config`](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/6a2eb9e63bcb3c52584580570d31cd91110d1f2e/rules/0013-modellayout_symbols.part#L2). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Insert US layout before a single layout | ||
! model layout = symbols | ||
* us = pc+%l%(v) | ||
* * = pc+us+%l%(v):2 | ||
|
||
! option = symbols | ||
multiple-groups = +multiple-groups | ||
|
||
! include evdev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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 ] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.