state: don't use xkb_state_serialize_* internally

The code in these cases is clearer when done directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-10-26 16:12:28 +02:00
parent 92360016fe
commit ee6f3f2809
1 changed files with 3 additions and 9 deletions

View File

@ -118,14 +118,10 @@ static const struct xkb_kt_map_entry *
get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key, get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key,
xkb_layout_index_t group) xkb_layout_index_t group)
{ {
const struct xkb_key_type *type; const struct xkb_key_type *type = key->groups[group].type;
xkb_mod_mask_t active_mods; xkb_mod_mask_t active_mods = state->cur.mods & type->mods.mask;
unsigned int i; unsigned int i;
type = key->groups[group].type;
active_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
active_mods &= type->mods.mask;
for (i = 0; i < type->num_entries; i++) for (i = 0; i < type->num_entries; i++)
if (type->map[i].mods.mask == active_mods) if (type->map[i].mods.mask == active_mods)
return &type->map[i]; return &type->map[i];
@ -199,14 +195,12 @@ wrap_group_into_range(int32_t group,
XKB_EXPORT xkb_layout_index_t XKB_EXPORT xkb_layout_index_t
xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t kc) xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t kc)
{ {
xkb_layout_index_t group =
xkb_state_serialize_layout(state, XKB_STATE_LAYOUT_EFFECTIVE);
const struct xkb_key *key = XkbKey(state->keymap, kc); const struct xkb_key *key = XkbKey(state->keymap, kc);
if (!key) if (!key)
return XKB_LAYOUT_INVALID; return XKB_LAYOUT_INVALID;
return wrap_group_into_range(group, key->num_groups, return wrap_group_into_range(state->cur.group, key->num_groups,
key->out_of_range_group_action, key->out_of_range_group_action,
key->out_of_range_group_number); key->out_of_range_group_number);
} }