From 5f613988c80c22b84c270b61942195bfb9a77bf7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 4 Sep 2012 17:20:46 +0300 Subject: [PATCH] Fold keymap->indicator_names into keymap->indicators This makes sense, since giving a name to an indicator 'activates' the indicator_map in that index. Signed-off-by: Ran Benita --- src/keymap-dump.c | 6 +++--- src/map.c | 4 ++-- src/xkb-priv.h | 2 +- src/xkbcomp/compat.c | 6 +++--- src/xkbcomp/keycodes.c | 5 +++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/keymap-dump.c b/src/keymap-dump.c index addeeba..aa3a272 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -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) { diff --git a/src/map.c b/src/map.c index cff6368..9a2be6b 100644 --- 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; diff --git a/src/xkb-priv.h b/src/xkb-priv.h index a06e90f..4e08bd0 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -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; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 4059572..69fefe0 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -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; } diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index 0029eee..1e3d605 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -109,8 +109,9 @@ * 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);