And here's the follow-up, to get rid of the group duplications. Note that
AFAICT, the protocol spec does not cover the case of xkb->core->xkb so we have
to do some guesswork here.

>From 82512610650f2695526d3b1f0c0a26e71ae02637 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <[EMAIL PROTECTED]>
Date: Mon, 22 Sep 2008 11:10:46 +0930
Subject: [PATCH] xkb: squash canonical types into explicit ones on core 
reconstruction.

If we update key types from core, and groups 2 - n have a canonical type but
the same symbols as the explicit type of group 1, assume that it was a core
sym duplication according to Section 12.4 of the XKB Protocol Spec.
Ignore the canonical types and pretend there's only one group for the key -
with the explicit key type.

The protocol spec does not cover this case, so we have to guess here.
---
 xkb/XKBMisc.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index eb5c381..6f63c2b 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -178,16 +178,23 @@ int               nGroups,tmp,groupsWidth;
        }
     }
 
-    /* step 7: check for all groups identical or all width 1 */
+    /* step 7: check for all groups identical or all width 1
+     *
+     * Special feature: if group 1 has an explicit type and all other groups
+     * have canonical types with same symbols, we assume it's info lost from
+     * the core replication.
+     */
     if (nGroups>1) {
-       Bool sameType,allOneLevel;
+       Bool sameType,allOneLevel, canonical = True;
        allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1);
        for (i=1,sameType=True;(allOneLevel||sameType)&&(i<nGroups);i++) {
            sameType=(sameType&&(types_inout[i]==types_inout[XkbGroup1Index]));
            if (allOneLevel)
                allOneLevel= (xkb->map->types[types_inout[i]].num_levels==1);
+           if (types_inout[i] > XkbLastRequiredType)
+               canonical = False;
        }
-       if ((sameType)&&
+       if (((sameType) || canonical)&&
            (!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){
            register int s;
            Bool        identical;
-- 
1.5.4.3

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to