mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-19 06:30:34 +01:00
xkb: fix core keyboard map generation. #14373
According to Section 12.4 of the XKB Protocol Spec, if a key only has a single
group but the keyboard has multiple groups defined, the core description of
the key is a duplication of the single group across all symbols. i.e.
G1L1 G1L2 G1L1 G1L2 G1L3 G1L4 G1L3 G1L4
The previous code generated G1L1 G1L2 G1L3 G1L4 G1L3 G1L4, leading to
"invented" groups when the process is reversed.
Note that this creates wrong key types on reconstruction from core to xkb,
i.e. any single-group key with a key type that is not one of the canonical
four (Sec 12.2.3), will get the assigned type on group 1, and a canonical type
for the other gruops.
X.Org Bug 14373 <http://bugs.freedesktop.org/show_bug.cgi?id=14373>
(cherry picked from commit ae986d1c73)
This commit is contained in:
parent
3bf826f590
commit
be3b3cb970
1 changed files with 34 additions and 5 deletions
|
|
@ -486,6 +486,40 @@ CARD8 keysPerMod[XkbNumModifiers];
|
|||
if (groupWidth>2)
|
||||
nOut= groupWidth;
|
||||
}
|
||||
|
||||
/* See XKB Protocol Sec, Section 12.4.
|
||||
A 1-group key with ABCDE on a 2 group keyboard must be
|
||||
duplicated across all groups as ABABCDECDE.
|
||||
*/
|
||||
if (nGroups == 1)
|
||||
{
|
||||
int idx;
|
||||
|
||||
groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
|
||||
|
||||
/* AB..CDE... -> ABABCDE... */
|
||||
if (groupWidth > 0 && maxSymsPerKey >= 3)
|
||||
pCore[2] = pCore[0];
|
||||
if (groupWidth > 1 && maxSymsPerKey >= 4)
|
||||
pCore[3] = pCore[1];
|
||||
|
||||
/* ABABCDE... -> ABABCDECDE */
|
||||
idx = 2 + groupWidth;
|
||||
while (groupWidth > 2 &&
|
||||
idx < maxSymsPerKey &&
|
||||
idx < groupWidth * 2)
|
||||
{
|
||||
pCore[idx] = pCore[idx - groupWidth + 2];
|
||||
idx++;
|
||||
}
|
||||
idx = 2 * groupWidth;
|
||||
if (idx < 4)
|
||||
idx = 4;
|
||||
/* 3 or more groups: ABABCDECDEABCDEABCDE */
|
||||
for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
|
||||
pCore[idx++] = pXKB[n];
|
||||
}
|
||||
|
||||
pXKB+= XkbKeyGroupsWidth(xkb,key);
|
||||
nOut+= 2;
|
||||
if (nGroups>1) {
|
||||
|
|
@ -507,11 +541,6 @@ CARD8 keysPerMod[XkbNumModifiers];
|
|||
}
|
||||
pXKB+= XkbKeyGroupsWidth(xkb,key);
|
||||
}
|
||||
if (!pCore[2] && !pCore[3] && maxSymsPerKey >= 6 &&
|
||||
(pCore[4] || pCore[5])) {
|
||||
pCore[2] = pCore[4];
|
||||
pCore[3] = pCore[5];
|
||||
}
|
||||
}
|
||||
if (keyc->modifierMap[key]!=0) {
|
||||
register unsigned bit,i,mask;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue