Fold keymap->indicator_names into keymap->indicators
authorRan Benita <ran234@gmail.com>
Tue, 4 Sep 2012 14:20:46 +0000 (17:20 +0300)
committerRan Benita <ran234@gmail.com>
Tue, 4 Sep 2012 14:20:46 +0000 (17:20 +0300)
This makes sense, since giving a name to an indicator 'activates' the
indicator_map in that index.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/keymap-dump.c
src/map.c
src/xkb-priv.h
src/xkbcomp/compat.c
src/xkbcomp/keycodes.c

index addeeba..aa3a272 100644 (file)
@@ -257,10 +257,10 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf)
     }
 
     for (i = 0; i < XkbNumIndicators; i++) {
-        if (!keymap->indicator_names[i])
+        if (keymap->indicators[i].name == XKB_ATOM_NONE)
             continue;
         write_buf(buf, "\t\tindicator %d = \"%s\";\n", i + 1,
-                  xkb_atom_text(keymap->ctx, keymap->indicator_names[i]));
+                  xkb_atom_text(keymap->ctx, keymap->indicators[i].name));
     }
 
 
@@ -340,7 +340,7 @@ write_indicator_map(struct xkb_keymap *keymap, struct buf *buf, int num)
     struct xkb_indicator_map *led = &keymap->indicators[num];
 
     write_buf(buf, "\t\tindicator \"%s\" {\n",
-              xkb_atom_text(keymap->ctx, keymap->indicator_names[num]));
+              xkb_atom_text(keymap->ctx, keymap->indicators[num].name));
 
     if (led->which_groups) {
         if (led->which_groups != XkbIM_UseEffective) {
index cff6368..9a2be6b 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -250,7 +250,7 @@ xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx)
     if (idx >= xkb_map_num_leds(keymap))
         return NULL;
 
-    return xkb_atom_text(keymap->ctx, keymap->indicator_names[idx]);
+    return xkb_atom_text(keymap->ctx, keymap->indicators[idx].name);
 }
 
 /**
@@ -267,7 +267,7 @@ xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name)
         return XKB_LED_INVALID;
 
     for (i = 0; i < num_leds; i++)
-        if (keymap->indicator_names[i] == atom)
+        if (keymap->indicators[i].name == atom)
             return i;
 
     return XKB_LED_INVALID;
index a06e90f..4e08bd0 100644 (file)
@@ -266,6 +266,7 @@ struct xkb_sym_interpret {
 };
 
 struct xkb_indicator_map {
+    xkb_atom_t name;
     unsigned char which_groups;
     uint32_t groups;
     unsigned char which_mods;
@@ -353,7 +354,6 @@ struct xkb_keymap {
     xkb_atom_t group_names[XkbNumKbdGroups];
 
     struct xkb_indicator_map indicators[XkbNumIndicators];
-    xkb_atom_t indicator_names[XkbNumIndicators];
 
     char *keycodes_section_name;
     char *symbols_section_name;
index 4059572..69fefe0 100644 (file)
@@ -967,7 +967,7 @@ CopyIndicatorMapDefs(CompatInfo *info)
          */
         im = NULL;
         for (i = 0; i < XkbNumIndicators; i++) {
-            if (keymap->indicator_names[i] == led->name) {
+            if (keymap->indicators[i].name == led->name) {
                 im = &keymap->indicators[i];
                 break;
             }
@@ -981,10 +981,10 @@ CopyIndicatorMapDefs(CompatInfo *info)
                     xkb_atom_text(keymap->ctx, led->name));
 
             for (i = 0; i < XkbNumIndicators; i++) {
-                if (keymap->indicator_names[i] != XKB_ATOM_NONE)
+                if (keymap->indicators[i].name != XKB_ATOM_NONE)
                     continue;
 
-                keymap->indicator_names[i] = led->name;
+                keymap->indicators[i].name = led->name;
                 im = &keymap->indicators[i];
                 break;
             }
index 0029eee..1e3d605 100644 (file)
  *      xkb_keycode_t min_key_code;
  *      xkb_keycode_t max_key_code;
  *      darray(struct xkb_key_alias) key_aliases;
- *      const char *indicator_names[XkbNumIndicators];
  *      char *keycodes_section_name;
+ * The 'name' field of indicators declared in xkb_keycodes:
+ *      struct xkb_indicator_map indicators[XkbNumIndicators];
  * Further, the array of keys:
  *      darray(struct xkb_key) keys;
  * had been resized to its final size (i.e. all of the xkb_key objects are
@@ -826,7 +827,7 @@ CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)
         if (led->name == XKB_ATOM_NONE)
             continue;
 
-        keymap->indicator_names[idx] = led->name;
+        keymap->indicators[idx].name = led->name;
     }
 
     ApplyAliases(info, keymap);