state: don't use xkb_keymap_num_layouts internally Clearer and more greppable this way. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/src/state.c b/src/state.c
index 2c126ba..eaa1f10 100644
--- a/src/state.c
+++ b/src/state.c
@@ -646,8 +646,6 @@ xkb_state_led_update_all(struct xkb_state *state)
static void
xkb_state_update_derived(struct xkb_state *state)
{
- xkb_layout_index_t num_groups = xkb_keymap_num_layouts(state->keymap);
-
state->cur.mods = (state->cur.base_mods |
state->cur.latched_mods |
state->cur.locked_mods);
@@ -655,13 +653,13 @@ xkb_state_update_derived(struct xkb_state *state)
/* TODO: Use groups_wrap control instead of always RANGE_WRAP. */
state->cur.locked_group = wrap_group_into_range(state->cur.locked_group,
- num_groups,
+ state->keymap->num_groups,
RANGE_WRAP, 0);
state->cur.group = wrap_group_into_range(state->cur.base_group +
state->cur.latched_group +
state->cur.locked_group,
- num_groups,
+ state->keymap->num_groups,
RANGE_WRAP, 0);
xkb_state_led_update_all(state);
@@ -1011,7 +1009,7 @@ xkb_state_layout_index_is_active(struct xkb_state *state,
{
int ret = 0;
- if (idx >= xkb_keymap_num_layouts(state->keymap))
+ if (idx >= state->keymap->num_groups)
return -1;
if (type & XKB_STATE_LAYOUT_EFFECTIVE)