x11/keymap: fix case with no actions
[platform/upstream/libxkbcommon.git] / src / state.c
index 16a4caa..b269e6d 100644 (file)
@@ -59,6 +59,8 @@
  *   - messages (very unlikely)
  */
 
+#include "config.h"
+
 #include "keymap.h"
 #include "keysym.h"
 #include "utf8.h"
@@ -116,17 +118,6 @@ struct xkb_state {
     struct xkb_keymap *keymap;
 };
 
-/*
- * If the virtual modifiers are not bound to anything, the entry
- * is not active and should be skipped. xserver does this with
- * cached entry->active field.
- */
-static bool
-entry_is_active(const struct xkb_key_type_entry *entry)
-{
-    return entry->mods.mods == 0 || entry->mods.mask != 0;
-}
-
 static const struct xkb_key_type_entry *
 get_entry_for_mods(const struct xkb_key_type *type, xkb_mod_mask_t mods)
 {
@@ -1373,7 +1364,7 @@ key_get_consumed(struct xkb_state *state, const struct xkb_key *key,
             if (XkbLevelsSameSyms(level, no_mods_level))
                 continue;
 
-            if (entry == matching_entry || my_popcount(entry->mods.mask) == 1)
+            if (entry == matching_entry || one_bit_set(entry->mods.mask))
                 consumed |= entry->mods.mask & ~entry->preserve.mask;
         }
         break;