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 <ran234@gmail.com>
master
Ran Benita 2012-09-04 17:20:46 +03:00
parent af2a8b3a37
commit 5f613988c8
5 changed files with 12 additions and 11 deletions

View File

@ -257,10 +257,10 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf)
} }
for (i = 0; i < XkbNumIndicators; i++) { for (i = 0; i < XkbNumIndicators; i++) {
if (!keymap->indicator_names[i]) if (keymap->indicators[i].name == XKB_ATOM_NONE)
continue; continue;
write_buf(buf, "\t\tindicator %d = \"%s\";\n", i + 1, 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]; struct xkb_indicator_map *led = &keymap->indicators[num];
write_buf(buf, "\t\tindicator \"%s\" {\n", 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) {
if (led->which_groups != XkbIM_UseEffective) { if (led->which_groups != XkbIM_UseEffective) {

View File

@ -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)) if (idx >= xkb_map_num_leds(keymap))
return NULL; 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; return XKB_LED_INVALID;
for (i = 0; i < num_leds; i++) for (i = 0; i < num_leds; i++)
if (keymap->indicator_names[i] == atom) if (keymap->indicators[i].name == atom)
return i; return i;
return XKB_LED_INVALID; return XKB_LED_INVALID;

View File

@ -266,6 +266,7 @@ struct xkb_sym_interpret {
}; };
struct xkb_indicator_map { struct xkb_indicator_map {
xkb_atom_t name;
unsigned char which_groups; unsigned char which_groups;
uint32_t groups; uint32_t groups;
unsigned char which_mods; unsigned char which_mods;
@ -353,7 +354,6 @@ struct xkb_keymap {
xkb_atom_t group_names[XkbNumKbdGroups]; xkb_atom_t group_names[XkbNumKbdGroups];
struct xkb_indicator_map indicators[XkbNumIndicators]; struct xkb_indicator_map indicators[XkbNumIndicators];
xkb_atom_t indicator_names[XkbNumIndicators];
char *keycodes_section_name; char *keycodes_section_name;
char *symbols_section_name; char *symbols_section_name;

View File

@ -967,7 +967,7 @@ CopyIndicatorMapDefs(CompatInfo *info)
*/ */
im = NULL; im = NULL;
for (i = 0; i < XkbNumIndicators; i++) { for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] == led->name) { if (keymap->indicators[i].name == led->name) {
im = &keymap->indicators[i]; im = &keymap->indicators[i];
break; break;
} }
@ -981,10 +981,10 @@ CopyIndicatorMapDefs(CompatInfo *info)
xkb_atom_text(keymap->ctx, led->name)); xkb_atom_text(keymap->ctx, led->name));
for (i = 0; i < XkbNumIndicators; i++) { for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] != XKB_ATOM_NONE) if (keymap->indicators[i].name != XKB_ATOM_NONE)
continue; continue;
keymap->indicator_names[i] = led->name; keymap->indicators[i].name = led->name;
im = &keymap->indicators[i]; im = &keymap->indicators[i];
break; break;
} }

View File

@ -109,8 +109,9 @@
* xkb_keycode_t min_key_code; * xkb_keycode_t min_key_code;
* xkb_keycode_t max_key_code; * xkb_keycode_t max_key_code;
* darray(struct xkb_key_alias) key_aliases; * darray(struct xkb_key_alias) key_aliases;
* const char *indicator_names[XkbNumIndicators];
* char *keycodes_section_name; * char *keycodes_section_name;
* The 'name' field of indicators declared in xkb_keycodes:
* struct xkb_indicator_map indicators[XkbNumIndicators];
* Further, the array of keys: * Further, the array of keys:
* darray(struct xkb_key) keys; * darray(struct xkb_key) keys;
* had been resized to its final size (i.e. all of the xkb_key objects are * 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) if (led->name == XKB_ATOM_NONE)
continue; continue;
keymap->indicator_names[idx] = led->name; keymap->indicators[idx].name = led->name;
} }
ApplyAliases(info, keymap); ApplyAliases(info, keymap);