state: light indicator when either condition is satisfied
For the indicator to be set, it is sufficient for at least one of the group, modifier, or control state to match; this is in line with the xkblib spec, section 8.2 and ComputeAutoState() in xserver/xkb/xkbLEDs.c (though the xserver implementation differs from the spec on some points...). This also adds a tiny optimization to skip the entire check if the mask is empty. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
d1b476a387
commit
a45b7d7559
|
@ -538,13 +538,13 @@ xkb_state_led_update_all(struct xkb_state *state)
|
|||
|
||||
for (led = 0; led < XkbNumIndicators; led++) {
|
||||
struct xkb_indicator_map *map = &state->keymap->indicators[led];
|
||||
uint32_t mod_mask = 0;
|
||||
xkb_mod_mask_t mod_mask = 0;
|
||||
uint32_t group_mask = 0;
|
||||
|
||||
if (!map->which_mods && !map->which_groups && !map->ctrls)
|
||||
continue;
|
||||
|
||||
if (map->which_mods) {
|
||||
if (map->which_mods & XkbIM_UseAnyMods) {
|
||||
if (map->which_mods & XkbIM_UseBase)
|
||||
mod_mask |= state->base_mods;
|
||||
if (map->which_mods & XkbIM_UseLatched)
|
||||
|
@ -556,7 +556,7 @@ xkb_state_led_update_all(struct xkb_state *state)
|
|||
if ((map->mods.mask & mod_mask))
|
||||
state->leds |= (1 << led);
|
||||
}
|
||||
else if (map->which_groups) {
|
||||
if (map->which_groups & XkbIM_UseAnyGroup) {
|
||||
if (map->which_groups & XkbIM_UseBase)
|
||||
group_mask |= (1 << state->base_group);
|
||||
if (map->which_groups & XkbIM_UseLatched)
|
||||
|
@ -568,7 +568,7 @@ xkb_state_led_update_all(struct xkb_state *state)
|
|||
if ((map->groups & group_mask))
|
||||
state->leds |= (1 << led);
|
||||
}
|
||||
else if (map->ctrls) {
|
||||
if (map->ctrls) {
|
||||
if ((map->ctrls & state->keymap->enabled_ctrls))
|
||||
state->leds |= (1 << led);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue