parent
ed08261768
commit
50fef8eb8a
25
src/alloc.c
25
src/alloc.c
|
@ -251,30 +251,6 @@ XkbcFreeControls(struct xkb_keymap *keymap)
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -305,7 +281,6 @@ XkbcFreeKeyboard(struct xkb_keymap *keymap)
|
|||
free(keymap->behaviors);
|
||||
free(keymap->vmodmap);
|
||||
darray_free(keymap->sym_interpret);
|
||||
XkbcFreeIndicatorMaps(keymap);
|
||||
XkbcFreeNames(keymap);
|
||||
XkbcFreeControls(keymap);
|
||||
xkb_context_unref(keymap->ctx);
|
||||
|
|
|
@ -36,9 +36,6 @@ XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
|
|||
extern int
|
||||
XkbcAllocControls(struct xkb_keymap *keymap);
|
||||
|
||||
extern int
|
||||
XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
|
||||
|
||||
extern struct xkb_keymap *
|
||||
XkbcAllocKeyboard(struct xkb_context *ctx);
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ static bool
|
|||
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]);
|
||||
|
@ -723,7 +723,7 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
}
|
||||
|
||||
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 &&
|
||||
|
|
|
@ -200,9 +200,9 @@ xkb_map_num_leds(struct xkb_keymap *keymap)
|
|||
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;
|
||||
|
|
|
@ -530,7 +530,7 @@ xkb_state_led_update_all(struct xkb_state *state)
|
|||
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;
|
||||
|
||||
|
|
|
@ -284,10 +284,6 @@ struct xkb_indicator_map {
|
|||
unsigned int ctrls;
|
||||
};
|
||||
|
||||
struct xkb_indicator {
|
||||
struct xkb_indicator_map maps[XkbNumIndicators];
|
||||
};
|
||||
|
||||
struct xkb_key_name {
|
||||
char name[XkbKeyNameLength];
|
||||
};
|
||||
|
@ -339,7 +335,6 @@ struct xkb_keymap {
|
|||
xkb_keycode_t max_key_code;
|
||||
|
||||
struct xkb_controls * ctrls;
|
||||
struct xkb_indicator * indicators;
|
||||
struct xkb_names * names;
|
||||
|
||||
/* key -> explicit flags mapping */
|
||||
|
@ -367,6 +362,8 @@ struct xkb_keymap {
|
|||
|
||||
/* key -> behavior mapping */
|
||||
struct xkb_behavior *behaviors;
|
||||
|
||||
struct xkb_indicator_map indicators[XkbNumIndicators];
|
||||
};
|
||||
|
||||
#define XkbNumGroups(g) ((g) & 0x0f)
|
||||
|
|
|
@ -1029,7 +1029,7 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
|||
}
|
||||
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;
|
||||
|
@ -428,11 +428,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
|||
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))
|
||||
|
@ -449,7 +445,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -769,10 +769,6 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
|||
|
||||
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]);
|
||||
|
|
Loading…
Reference in New Issue