xserver: Branch 'master' - 5 commits
Peter Hutterer
whot at kemper.freedesktop.org
Mon Dec 22 15:14:31 PST 2008
dix/devices.c | 12 +++++---
xkb/XKBMisc.c | 84 ++++++++++++++++++++++++++++++++++++++++++++-------------
xkb/xkbUtils.c | 26 ++++++++++++++---
3 files changed, 94 insertions(+), 28 deletions(-)
New commits:
commit 477c32708718f4470ac2e786b2446d7a44e45b9c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Dec 19 08:56:35 2008 +1000
dix: don't disable uninitialized devices.
If a device hasn't been initialized, it doesn't have a cursor yet. So don't
set the cursor to the NullCursor, and don't try to DisableDevice either.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/devices.c b/dix/devices.c
index 48b6e7d..ff6f0ec 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -965,11 +965,15 @@ RemoveDevice(DeviceIntPtr dev)
return BadImplementation;
initialized = dev->inited;
- if (DevHasCursor(dev))
- screen->DisplayCursor(dev, screen, NullCursor);
-
deviceid = dev->id;
- DisableDevice(dev);
+
+ if (initialized)
+ {
+ if (DevHasCursor(dev))
+ screen->DisplayCursor(dev, screen, NullCursor);
+
+ DisableDevice(dev);
+ }
prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
commit 25aac8b5793caa92116b766d5a9e12dbecdb0290
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Tue Dec 2 16:16:58 2008 +1000
xkb: don't treat groups with different no of symbols as identical.
Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index f324103..078f241 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -242,6 +242,8 @@ BOOL replicated = FALSE;
Bool identical;
for (i=1,identical=True;identical&&(i<nGroups);i++) {
KeySym *syms;
+ if (nSyms[i] != nSyms[XkbGroup1Index])
+ identical = False;
syms= &xkb_syms_rtrn[XKB_OFFSET(i,0)];
for (s=0;identical&&(s<nSyms[i]);s++) {
if (syms[s]!=xkb_syms_rtrn[s])
commit f141c1b4bb9482f188783dd6f161d3c7960a3329
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Tue Dec 2 14:54:50 2008 +1000
xkb: explicitly check for group replication in the core representation.
Single-group keys may get replicated amongst all groups. Check explicitly for
this case and squash it down to one group.
Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 39bbec6..f324103 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -56,6 +56,7 @@ register int i;
unsigned int empty;
int nSyms[XkbNumKbdGroups];
int nGroups,tmp,groupsWidth;
+BOOL replicated = FALSE;
/* Section 12.2 of the protocol describes this process in more detail */
/* Step 1: find the # of symbols in the core mapping per group */
@@ -89,27 +90,70 @@ int nGroups,tmp,groupsWidth;
for (i=2;i<nSyms[XkbGroup2Index];i++) {
xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index,i)]= CORE_SYM(tmp+i);
}
- tmp= nSyms[XkbGroup1Index]+nSyms[XkbGroup2Index];
- if ((tmp>=map_width)&&
- ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) {
+
+ /* Special case: if only the first group is explicit, and the symbols
+ * replicate across all groups, then we have a Section 12.4 replication */
+ if ((protected & ~XkbExplicitKeyType1Mask) == 0)
+ {
+ int j, width = nSyms[XkbGroup1Index];
+
+ replicated = TRUE;
+
+ /* Check ABAB in ABABCDECDEABCDE */
+ if ((width > 0 && CORE_SYM(0) != CORE_SYM(2)) ||
+ (width > 1 && CORE_SYM(1) != CORE_SYM(3)))
+ replicated = FALSE;
+
+ /* Check CDECDE in ABABCDECDEABCDE */
+ for (i = 2; i < width && replicated; i++)
+ {
+ if (CORE_SYM(2 + i) != CORE_SYM(i + width))
+ replicated = FALSE;
+ }
+
+ /* Check ABCDE in ABABCDECDEABCDE */
+ for (j = 2; replicated &&
+ j < XkbNumKbdGroups &&
+ map_width >= width * (j + 1); j++)
+ {
+ for (i = 0; i < width && replicated; i++)
+ {
+ if (CORE_SYM(((i < 2) ? i : 2 + i)) != CORE_SYM(i + width * j))
+ replicated = FALSE;
+ }
+ }
+ }
+
+ if (replicated)
+ {
+ nSyms[XkbGroup2Index]= 0;
nSyms[XkbGroup3Index]= 0;
nSyms[XkbGroup4Index]= 0;
- nGroups= 2;
- }
- else {
- nGroups= 3;
- for (i=0;i<nSyms[XkbGroup3Index];i++,tmp++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index,i)]= CORE_SYM(tmp);
- }
- if ((tmp<map_width)||(protected&XkbExplicitKeyType4Mask)) {
- nGroups= 4;
- for (i=0;i<nSyms[XkbGroup4Index];i++,tmp++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index,i)]= CORE_SYM(tmp);
- }
- }
- else {
- nSyms[XkbGroup4Index]= 0;
- }
+ nGroups= 1;
+ } else
+ {
+ tmp= nSyms[XkbGroup1Index]+nSyms[XkbGroup2Index];
+ if ((tmp>=map_width)&&
+ ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) {
+ nSyms[XkbGroup3Index]= 0;
+ nSyms[XkbGroup4Index]= 0;
+ nGroups= 2;
+ } else
+ {
+ nGroups= 3;
+ for (i=0;i<nSyms[XkbGroup3Index];i++,tmp++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index,i)]= CORE_SYM(tmp);
+ }
+ if ((tmp<map_width)||(protected&XkbExplicitKeyType4Mask)) {
+ nGroups= 4;
+ for (i=0;i<nSyms[XkbGroup4Index];i++,tmp++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index,i)]= CORE_SYM(tmp);
+ }
+ }
+ else {
+ nSyms[XkbGroup4Index]= 0;
+ }
+ }
}
/* steps 3&4: alphanumeric expansion, assign canonical types */
empty= 0;
commit 70a977c021e107c4fabe46ec2f619be9fb55abeb
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Tue Dec 2 15:36:51 2008 +1000
xkb: don't replicate past the number of groups we have.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index f13d292..7c39bcc 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -524,7 +524,7 @@ int maxNumberOfGroups;
*/
if (nGroups == 1)
{
- int idx;
+ int idx, j;
groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
@@ -547,8 +547,9 @@ int maxNumberOfGroups;
if (idx < 4)
idx = 4;
/* 3 or more groups: ABABCDECDEABCDEABCDE */
- for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
- pCore[idx++] = pXKB[n];
+ for (j = 3; j <= maxNumberOfGroups; j++)
+ for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
+ pCore[idx++] = pXKB[n];
}
pXKB+= XkbKeyGroupsWidth(xkb,key);
commit a157575eeeb523cd43197c5caeb00cb3d56f9988
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Tue Dec 2 13:31:58 2008 +1000
xkb: ensure enough symbols for core Group1 replication.
A single-group key on a multi-group keyboard has to be replicated across all
three groups (see Section 12.4 of the XKB protocol spec). Ensure that there's
enough symbols available to actually do that.
e.g. a key ABCD on a 3 group keyboard needs to be replicated as ABABCDCDABCD,
hence requiring space for 12 symbols, even if maxSymsPerKey is less than that.
Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 6b5acd8..f13d292 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -361,17 +361,19 @@ void
XkbUpdateCoreDescription(DeviceIntPtr keybd,Bool resize)
{
register int key,tmp;
-int maxSymsPerKey,maxKeysPerMod;
+int maxSymsPerKey,maxKeysPerMod, maxGroup1Width;
int first,last,firstCommon,lastCommon;
XkbDescPtr xkb;
KeyClassPtr keyc;
CARD8 keysPerMod[XkbNumModifiers];
+int maxNumberOfGroups;
if (!keybd || !keybd->key || !keybd->key->xkbInfo)
return;
xkb= keybd->key->xkbInfo->desc;
keyc= keybd->key;
- maxSymsPerKey= maxKeysPerMod= 0;
+ maxSymsPerKey= maxKeysPerMod= maxGroup1Width= 0;
+ maxNumberOfGroups = 0;
bzero(keysPerMod,sizeof(keysPerMod));
memcpy(keyc->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
if ((xkb->min_key_code==keyc->curKeySyms.minKeyCode)&&
@@ -419,6 +421,9 @@ CARD8 keysPerMod[XkbNumModifiers];
if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup1Index))<=2)
tmp+= 2;
else tmp+= w + 2;
+ /* remember highest G1 width */
+ if (w > maxGroup1Width)
+ maxGroup1Width = w;
}
if (nGroups>1) {
if (tmp <= 2) {
@@ -436,6 +441,8 @@ CARD8 keysPerMod[XkbNumModifiers];
tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup4Index);
if (tmp>maxSymsPerKey)
maxSymsPerKey= tmp;
+ if (nGroups > maxNumberOfGroups)
+ maxNumberOfGroups = nGroups;
}
if (_XkbCoreKeycodeInRange(keyc,key)) {
if (keyc->modifierMap[key]!=0) {
@@ -469,6 +476,14 @@ CARD8 keysPerMod[XkbNumModifiers];
keyc->maxKeysPerModifier= maxKeysPerMod;
if (maxSymsPerKey>0) {
+ /* See Section 12.4 of the XKB Protocol spec. Because of the
+ * single-group distribution for multi-group keyboards, we have to
+ * have enough symbols for the largest group 1 to replicate across the
+ * number of groups on the keyboard. e.g. a single-group key with 4
+ * symbols on a keyboard that has 3 groups -> 12 syms per key */
+ if (maxSymsPerKey < maxNumberOfGroups * maxGroup1Width)
+ maxSymsPerKey = maxNumberOfGroups * maxGroup1Width;
+
tmp= maxSymsPerKey*_XkbCoreNumKeys(keyc);
keyc->curKeySyms.map= _XkbTypedRealloc(keyc->curKeySyms.map,tmp,KeySym);
if (keyc->curKeySyms.map==NULL)
More information about the xorg-commit
mailing list