diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index d309ccb..b88623f 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -825,7 +825,7 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge info.leds = NULL; } - if (!BindIndicators(keymap, true, unbound, NULL)) { + if (!BindIndicators(keymap, unbound, NULL)) { while (unbound) { next = (LEDInfo *) unbound->defs.next; free(unbound); diff --git a/src/xkbcomp/indicators.c b/src/xkbcomp/indicators.c index 328bf3f..7c0f9b6 100644 --- a/src/xkbcomp/indicators.c +++ b/src/xkbcomp/indicators.c @@ -433,8 +433,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds, } bool -BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound, - LEDInfo **unboundRtrn) +BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound, LEDInfo **unboundRtrn) { int i; LEDInfo *led, *next, *last; @@ -457,30 +456,27 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound, } } } - if (force) + for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) { - for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) + if (led->indicator == _LED_NotBound) { + for (i = 0; i < XkbNumIndicators; i++) + { + if (keymap->names->indicators[i] == NULL) + { + keymap->names->indicators[i] = + xkb_atom_strdup(keymap->ctx, led->name); + led->indicator = i + 1; + break; + } + } if (led->indicator == _LED_NotBound) { - for (i = 0; i < XkbNumIndicators; i++) - { - if (keymap->names->indicators[i] == NULL) - { - keymap->names->indicators[i] = - xkb_atom_strdup(keymap->ctx, led->name); - led->indicator = i + 1; - break; - } - } - if (led->indicator == _LED_NotBound) - { - ERROR("No unnamed indicators found\n"); - ACTION - ("Virtual indicator map \"%s\" not bound\n", - xkb_atom_text(keymap->ctx, led->name)); - continue; - } + ERROR("No unnamed indicators found\n"); + ACTION + ("Virtual indicator map \"%s\" not bound\n", + xkb_atom_text(keymap->ctx, led->name)); + continue; } } } @@ -490,19 +486,8 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound, next = (LEDInfo *) led->defs.next; if (led->indicator == _LED_NotBound) { - if (force) - { - unbound = next; - free(led); - } - else - { - if (last) - last->defs.next = &led->defs; - else - unbound = led; - last = led; - } + unbound = next; + free(led); } else { @@ -516,19 +501,8 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound, ACTION("Using %s, ignoring %s\n", old, xkb_atom_text(keymap->ctx, led->name)); led->indicator = _LED_NotBound; - if (force) - { - free(led); - unbound = next; - } - else - { - if (last) - last->defs.next = &led->defs; - else - unbound = led; - last = led; - } + unbound = next; + free(led); } else { diff --git a/src/xkbcomp/indicators.h b/src/xkbcomp/indicators.h index 66d8b82..6d7f2b0 100644 --- a/src/xkbcomp/indicators.h +++ b/src/xkbcomp/indicators.h @@ -73,7 +73,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds, LEDInfo **unboundRtrn); extern bool -BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound, +BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound, LEDInfo **unboundRtrn); #endif /* INDICATORS_H */