types: don't compute effective masks here as well After compiling all of the sections, UpdateModifiersFromCompat does all of the vmod -> real mods translations, including types/kt_entries. keytypes.c also has code that does that, but it's unneeded: - Later sections don't look at their effective masks, so doing it later is fine. - When this code is executed, the vmods -> real mods mapping is empty (that is set up later), so VModsToReal has no effect here. So we can just remove it. However UpdateModifiersFromCompat didn't update the preserve mask, so do that. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index b877b91..bbd03e1 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -1505,10 +1505,13 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
type->mods.mask |= VModsToReal(keymap, type->mods.vmods);
for (j = 0; j < type->num_entries; j++) {
- type->map[j].mods.mask = 0;
- type->map[j].mods.mask |= type->map[j].mods.real_mods;
- type->map[j].mods.mask |= VModsToReal(keymap,
- type->map[j].mods.vmods);
+ struct xkb_kt_map_entry *entry = &type->map[j];
+
+ entry->mods.mask = entry->mods.real_mods;
+ entry->mods.mask |= VModsToReal(keymap, entry->mods.vmods);
+
+ entry->preserve.mask = entry->preserve.real_mods;
+ entry->preserve.mask |= VModsToReal(keymap, entry->preserve.vmods);
}
}
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index da72497..32107c3 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -877,28 +877,6 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
}
static bool
-ComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type)
-{
- unsigned int i;
- struct xkb_kt_map_entry *entry;
-
- type->mods.mask = type->mods.real_mods;
- type->mods.mask |= VModsToReal(keymap, type->mods.vmods);
-
- for (i = 0; i < type->num_entries; i++) {
- entry = &type->map[i];
-
- entry->mods.mask = entry->mods.real_mods;
- entry->mods.mask |= VModsToReal(keymap, entry->mods.vmods);
-
- entry->preserve.mask = entry->preserve.real_mods;
- entry->preserve.mask |= VModsToReal(keymap, entry->preserve.vmods);
- }
-
- return true;
-}
-
-static bool
CopyDefToKeyType(KeyTypesInfo *info, KeyTypeInfo *def,
struct xkb_key_type *type)
{
@@ -912,7 +890,7 @@ CopyDefToKeyType(KeyTypesInfo *info, KeyTypeInfo *def,
type->level_names = darray_mem(def->level_names, 0);
darray_init(def->level_names);
- return ComputeEffectiveMap(info->keymap, type);
+ return true;
}
bool