include resets group compatibility modifiers #43091
authorDaniel Stone <daniel@fooishbar.org>
Tue, 3 Apr 2012 12:44:21 +0000 (13:44 +0100)
committerDaniel Stone <daniel@fooishbar.org>
Tue, 3 Apr 2012 14:11:42 +0000 (15:11 +0100)
This change makes sure that include does not overwrite previous
compatibility modifier settings when the included files does not
explicitly specify them.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
[Cross-picked from xkbcomp commit 14470719.]

src/xkbcomp/compat.c

index 91c9df2..5db2950 100644 (file)
@@ -50,6 +50,7 @@ typedef struct _GroupCompatInfo
 {
     unsigned char fileID;
     unsigned char merge;
+    Bool defined;
     unsigned char real_mods;
     xkb_atom_t vmods;
 } GroupCompatInfo;
@@ -278,7 +279,7 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
         ACTION("Using %s definition\n",
                 (merge == MergeAugment ? "old" : "new"));
     }
-    if (merge != MergeAugment)
+    if (newGC->defined && (merge != MergeAugment || !gc->defined))
         *gc = *newGC;
     return True;
 }
@@ -697,6 +698,7 @@ HandleGroupCompatDef(GroupCompatDef * def,
     }
     tmp.real_mods = val.uval & 0xff;
     tmp.vmods = (val.uval >> 8) & 0xffff;
+    tmp.defined = True;
     return AddGroupCompat(info, def->group - 1, &tmp);
 }