Commit 57bfde3aff9b3a98f764a3bd3eeb924e299ae9b7

Ran Benita 2013-03-04T18:41:13

keymap: rename xkb_kt_map_entry to xkb_key_type_entry That's a better name and fits more nicely. Also change type->map to type->entries. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/keymap.c b/src/keymap.c
index 480a4ce..8404c03 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -102,7 +102,7 @@ xkb_keymap_unref(struct xkb_keymap *keymap)
         free(keymap->keys);
     }
     for (i = 0; i < keymap->num_types; i++) {
-        free(keymap->types[i].map);
+        free(keymap->types[i].entries);
         free(keymap->types[i].level_names);
     }
     free(keymap->types);
diff --git a/src/keymap.h b/src/keymap.h
index 0f3d6bb..12a2771 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -256,19 +256,19 @@ union xkb_action {
     struct xkb_private_action priv;
 };
 
-struct xkb_kt_map_entry {
+struct xkb_key_type_entry {
     xkb_level_index_t level;
     struct xkb_mods mods;
     struct xkb_mods preserve;
 };
 
 struct xkb_key_type {
+    xkb_atom_t name;
     struct xkb_mods mods;
     xkb_level_index_t num_levels;
-    struct xkb_kt_map_entry *map;
-    unsigned int num_entries;
-    xkb_atom_t name;
     xkb_atom_t *level_names;
+    unsigned int num_entries;
+    struct xkb_key_type_entry *entries;
 };
 
 struct xkb_sym_interpret {
diff --git a/src/state.c b/src/state.c
index 79a6794..d61bed7 100644
--- a/src/state.c
+++ b/src/state.c
@@ -114,7 +114,7 @@ struct xkb_state {
     struct xkb_keymap *keymap;
 };
 
-static const struct xkb_kt_map_entry *
+static const struct xkb_key_type_entry *
 get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key,
                         xkb_layout_index_t group)
 {
@@ -128,11 +128,11 @@ get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key,
          * supposed to skip the entry (xserver does this with cached
          * entry->active field).
          */
-        if (!type->map[i].mods.mask)
+        if (!type->entries[i].mods.mask)
             continue;
 
-        if (type->map[i].mods.mask == active_mods)
-            return &type->map[i];
+        if (type->entries[i].mods.mask == active_mods)
+            return &type->entries[i];
     }
 
     return NULL;
@@ -147,7 +147,7 @@ xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
                         xkb_layout_index_t layout)
 {
     const struct xkb_key *key = XkbKey(state->keymap, kc);
-    const struct xkb_kt_map_entry *entry;
+    const struct xkb_key_type_entry *entry;
 
     if (!key || layout >= key->num_groups)
         return XKB_LEVEL_INVALID;
@@ -1085,7 +1085,7 @@ xkb_state_led_name_is_active(struct xkb_state *state, const char *name)
 static xkb_mod_mask_t
 key_get_consumed(struct xkb_state *state, const struct xkb_key *key)
 {
-    const struct xkb_kt_map_entry *entry;
+    const struct xkb_key_type_entry *entry;
     xkb_layout_index_t group;
 
     group = xkb_state_key_get_layout(state, key->keycode);
diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c
index 5c57e17..034a8c1 100644
--- a/src/xkbcomp/keymap-dump.c
+++ b/src/xkbcomp/keymap-dump.c
@@ -202,7 +202,7 @@ write_types(struct xkb_keymap *keymap, struct buf *buf)
 
         for (unsigned j = 0; j < type->num_entries; j++) {
             const char *str;
-            const struct xkb_kt_map_entry *entry = &type->map[j];
+            const struct xkb_key_type_entry *entry = &type->entries[j];
 
             /*
              * Printing level 1 entries is redundant, it's the default,
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index 6686948..5f4bfb6 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -201,8 +201,8 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap)
         ComputeEffectiveMask(keymap, &keymap->types[i].mods);
 
         for (j = 0; j < keymap->types[i].num_entries; j++) {
-            ComputeEffectiveMask(keymap, &keymap->types[i].map[j].mods);
-            ComputeEffectiveMask(keymap, &keymap->types[i].map[j].preserve);
+            ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].mods);
+            ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].preserve);
         }
     }
 
diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c
index 26eb3e7..1eb1b73 100644
--- a/src/xkbcomp/types.c
+++ b/src/xkbcomp/types.c
@@ -149,7 +149,7 @@ typedef struct {
     xkb_atom_t name;
     xkb_mod_mask_t mods;
     xkb_level_index_t num_levels;
-    darray(struct xkb_kt_map_entry) entries;
+    darray(struct xkb_key_type_entry) entries;
     darray(xkb_atom_t) level_names;
 } KeyTypeInfo;
 
@@ -164,7 +164,7 @@ typedef struct {
 /***====================================================================***/
 
 static inline const char *
-MapEntryTxt(KeyTypesInfo *info, struct xkb_kt_map_entry *entry)
+MapEntryTxt(KeyTypesInfo *info, struct xkb_key_type_entry *entry)
 {
     return ModMaskText(info->keymap, entry->mods.mods);
 }
@@ -379,10 +379,10 @@ SetModifiers(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
 
 /***====================================================================***/
 
-static struct xkb_kt_map_entry *
+static struct xkb_key_type_entry *
 FindMatchingMapEntry(KeyTypeInfo *type, xkb_mod_mask_t mods)
 {
-    struct xkb_kt_map_entry *entry;
+    struct xkb_key_type_entry *entry;
 
     darray_foreach(entry, type->entries)
         if (entry->mods.mods == mods)
@@ -393,9 +393,9 @@ FindMatchingMapEntry(KeyTypeInfo *type, xkb_mod_mask_t mods)
 
 static bool
 AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type,
-            struct xkb_kt_map_entry *new, bool clobber, bool report)
+            struct xkb_key_type_entry *new, bool clobber, bool report)
 {
-    struct xkb_kt_map_entry *old;
+    struct xkb_key_type_entry *old;
 
     old = FindMatchingMapEntry(type, new->mods.mods);
     if (old) {
@@ -435,7 +435,7 @@ static bool
 SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
             ExprDef *value)
 {
-    struct xkb_kt_map_entry entry;
+    struct xkb_key_type_entry entry;
 
     if (arrayNdx == NULL)
         return ReportTypeShouldBeArray(info, type, "map entry");
@@ -471,8 +471,8 @@ static bool
 AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
             xkb_mod_mask_t mods, xkb_mod_mask_t preserve_mods)
 {
-    struct xkb_kt_map_entry *entry;
-    struct xkb_kt_map_entry new;
+    struct xkb_key_type_entry *entry;
+    struct xkb_key_type_entry new;
 
     darray_foreach(entry, type->entries) {
         if (entry->mods.mods != mods)
@@ -791,7 +791,7 @@ CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info)
 
         type->mods.mods = 0;
         type->num_levels = 1;
-        type->map = NULL;
+        type->entries = NULL;
         type->num_entries = 0;
         type->name = xkb_atom_intern(keymap->ctx, "default");
         type->level_names = NULL;
@@ -805,7 +805,7 @@ CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info)
 
         type->mods.mods = def->mods;
         type->num_levels = def->num_levels;
-        type->map = darray_mem(def->entries, 0);
+        type->entries = darray_mem(def->entries, 0);
         type->num_entries = darray_size(def->entries);
         darray_init(def->entries);
         type->name = def->name;