}
}
-int
-XkbcAllocIndicatorMaps(struct xkb_keymap *keymap)
-{
- if (!keymap)
- return BadMatch;
-
- if (!keymap->indicators) {
- keymap->indicators = uTypedCalloc(1, struct xkb_indicator);
- if (!keymap->indicators)
- return BadAlloc;
- }
-
- return Success;
-}
-
-static void
-XkbcFreeIndicatorMaps(struct xkb_keymap *keymap)
-{
- if (keymap) {
- free(keymap->indicators);
- keymap->indicators = NULL;
- }
-}
-
struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_context *ctx)
{
free(keymap->behaviors);
free(keymap->vmodmap);
darray_free(keymap->sym_interpret);
- XkbcFreeIndicatorMaps(keymap);
XkbcFreeNames(keymap);
XkbcFreeControls(keymap);
xkb_context_unref(keymap->ctx);
extern int
XkbcAllocControls(struct xkb_keymap *keymap);
-extern int
-XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
-
extern struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_context *ctx);
write_indicator_map(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset, int num)
{
- struct xkb_indicator_map *led = &keymap->indicators->maps[num];
+ struct xkb_indicator_map *led = &keymap->indicators[num];
write_buf(keymap, buf, size, offset, "\t\tindicator \"%s\" {\n",
keymap->names->indicators[num]);
}
for (i = 0; i < XkbNumIndicators; i++) {
- struct xkb_indicator_map *map = &keymap->indicators->maps[i];
+ struct xkb_indicator_map *map = &keymap->indicators[i];
if (map->flags == 0 && map->which_groups == 0 &&
map->groups == 0 && map->which_mods == 0 &&
map->mods.real_mods == 0 && map->mods.vmods == 0 &&
xkb_led_index_t i;
for (i = 0; i < XkbNumIndicators; i++)
- if (keymap->indicators->maps[i].which_groups ||
- keymap->indicators->maps[i].which_mods ||
- keymap->indicators->maps[i].ctrls)
+ if (keymap->indicators[i].which_groups ||
+ keymap->indicators[i].which_mods ||
+ keymap->indicators[i].ctrls)
ret++;
return ret;
state->leds = 0;
for (led = 0; led < XkbNumIndicators; led++) {
- struct xkb_indicator_map *map = &state->keymap->indicators->maps[led];
+ struct xkb_indicator_map *map = &state->keymap->indicators[led];
uint32_t mod_mask = 0;
uint32_t group_mask = 0;
unsigned int ctrls;
};
-struct xkb_indicator {
- struct xkb_indicator_map maps[XkbNumIndicators];
-};
-
struct xkb_key_name {
char name[XkbKeyNameLength];
};
xkb_keycode_t max_key_code;
struct xkb_controls * ctrls;
- struct xkb_indicator * indicators;
struct xkb_names * names;
/* key -> explicit flags mapping */
/* key -> behavior mapping */
struct xkb_behavior *behaviors;
+
+ struct xkb_indicator_map indicators[XkbNumIndicators];
};
#define XkbNumGroups(g) ((g) & 0x0f)
/* Update vmod -> indicator maps. */
for (i = 0; i < XkbNumIndicators; i++) {
- struct xkb_mods *led = &keymap->indicators->maps[i].mods;
+ struct xkb_mods *led = &keymap->indicators[i].mods;
led->mask = led->real_mods | VModsToReal(keymap, led->vmods);
}
}
else {
struct xkb_indicator_map * map;
- map = &keymap->indicators->maps[led->indicator - 1];
+ map = &keymap->indicators[led->indicator - 1];
map->flags = led->flags;
map->which_groups = led->which_groups;
map->groups = led->groups;
WSGO("Couldn't allocate names\n");
ACTION("Indicator names may be incorrect\n");
}
- if (XkbcAllocIndicatorMaps(keymap) != Success) {
- WSGO("Can't allocate indicator maps\n");
- ACTION("Indicator map definitions may be lost\n");
- return false;
- }
+
for (led = leds; led != NULL; led = next) {
next = (LEDInfo *) led->defs.next;
if ((led->groups != 0) && (led->which_groups == 0))
}
else {
struct xkb_indicator_map * im;
- im = &keymap->indicators->maps[led->indicator - 1];
+ im = &keymap->indicators[led->indicator - 1];
im->flags = led->flags;
im->which_groups = led->which_groups;
im->groups = led->groups;
if (info.leds) {
IndicatorNameInfo *ii;
- if (XkbcAllocIndicatorMaps(keymap) != Success) {
- WSGO("Couldn't allocate IndicatorRec in CompileKeycodes\n");
- ACTION("Physical indicators not set\n");
- }
for (ii = info.leds; ii; ii = (IndicatorNameInfo *) ii->defs.next) {
free(keymap->names->indicators[ii->ndx - 1]);