From 41478b4309a4c69f7b641901849e0379dc23649b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 9 Aug 2012 01:30:22 +0300 Subject: [PATCH] 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 --- src/xkbcomp/compat.c | 11 +++++++---- src/xkbcomp/keytypes.c | 24 +----------------------- 2 files changed, 8 insertions(+), 27 deletions(-) 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 @@ -876,28 +876,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