state: simplify xkb_state_mod_index_is_active
authorRan Benita <ran234@gmail.com>
Wed, 3 Oct 2012 18:21:05 +0000 (20:21 +0200)
committerRan Benita <ran234@gmail.com>
Sat, 6 Oct 2012 19:41:58 +0000 (21:41 +0200)
Signed-off-by: Ran Benita <ran234@gmail.com>
src/state.c

index 95b9e66..d9338ee 100644 (file)
@@ -836,22 +836,10 @@ xkb_state_mod_index_is_active(struct xkb_state *state,
                               xkb_mod_index_t idx,
                               enum xkb_state_component type)
 {
-    int ret = 0;
-
     if (idx >= xkb_keymap_num_mods(state->keymap))
         return -1;
 
-    if (type == XKB_STATE_EFFECTIVE)
-        return !!(state->mods & (1 << idx));
-
-    if (type & XKB_STATE_DEPRESSED)
-        ret |= (state->base_mods & (1 << idx));
-    if (type & XKB_STATE_LATCHED)
-        ret |= (state->latched_mods & (1 << idx));
-    if (type & XKB_STATE_LOCKED)
-        ret |= (state->locked_mods & (1 << idx));
-
-    return !!ret;
+    return !!(xkb_state_serialize_mods(state, type) & (1 << idx));
 }
 
 /**