From ee6f3f280976ac2db4176389cbac7e168e023f21 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 26 Oct 2012 16:12:28 +0200 Subject: [PATCH] state: don't use xkb_state_serialize_* internally The code in these cases is clearer when done directly. Signed-off-by: Ran Benita --- src/state.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/state.c b/src/state.c index ad8c203..2c126ba 100644 --- a/src/state.c +++ b/src/state.c @@ -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, xkb_layout_index_t group) { - const struct xkb_key_type *type; - xkb_mod_mask_t active_mods; + const struct xkb_key_type *type = key->groups[group].type; + xkb_mod_mask_t active_mods = state->cur.mods & type->mods.mask; 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++) if (type->map[i].mods.mask == active_mods) return &type->map[i]; @@ -199,14 +195,12 @@ wrap_group_into_range(int32_t group, XKB_EXPORT xkb_layout_index_t 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); if (!key) 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_number); } -- 2.34.1