table.c: Fix a coverity warning of uninitialized value 'dummy'
[platform/upstream/libxkbcommon.git] / src / keymap.h
index c15052b..f7ea5bd 100644 (file)
 /* Don't allow more leds than we can hold in xkb_led_mask_t. */
 #define XKB_MAX_LEDS ((xkb_led_index_t) (sizeof(xkb_led_mask_t) * 8))
 
+/* Special value to handle modMap None {…} */
+#define XKB_MOD_NONE 0xffffffffU
+
 /* These should all go away. */
 enum mod_type {
     MOD_REAL = (1 << 0),
@@ -438,6 +441,17 @@ XkbKeyNumLevels(const struct xkb_key *key, xkb_layout_index_t layout)
     return key->groups[layout].type->num_levels;
 }
 
+/*
+ * 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 inline bool
+entry_is_active(const struct xkb_key_type_entry *entry)
+{
+    return entry->mods.mods == 0 || entry->mods.mask != 0;
+}
+
 struct xkb_keymap *
 xkb_keymap_new(struct xkb_context *ctx,
                enum xkb_keymap_format format,