From 424de613af4c0a8121213bbee8c4fdd8364612e5 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 5 Oct 2012 22:46:21 +0200 Subject: Keep real and virtual mods in the same table in the keymap We change the keymap->vmods array into keymap->mods, and change it's member type from struct xkb_vmod to struct xkb_mod. This table now includes the real modifiers in the first 8 places. To distinguish between them, we add an enum mod_type to struct xkb_mod. Besides being a more reasonable approach, this enables us to share some code later, remove XKB_NUM_CORE_MODS (though the 0xff mask still appears in a few places), and prepares us to flat out remove the distinction in the future. This commit just does the conversion. Signed-off-by: Ran Benita --- src/keymap.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/keymap.h') diff --git a/src/keymap.h b/src/keymap.h index f50b091..0bc6509 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -103,13 +103,17 @@ */ #define XKB_NUM_GROUPS 4 -/* Don't allow more vmods than we can hold in xkb_mod_mask_t. */ -#define XKB_MAX_VIRTUAL_MODS \ - ((xkb_mod_index_t) (sizeof(xkb_mod_mask_t) * 8 - XKB_NUM_CORE_MODS)) +/* Don't allow more modifiers than we can hold in xkb_mod_mask_t. */ +#define XKB_MAX_MODS ((xkb_mod_index_t) (sizeof(xkb_mod_mask_t) * 8)) /* These should all be dynamic. */ #define XKB_NUM_INDICATORS 32 -#define XKB_NUM_CORE_MODS 8 + +enum mod_type { + MOD_REAL = (1 << 0), + MOD_VIRT = (1 << 1), + MOD_BOTH = (MOD_REAL | MOD_VIRT), +}; enum xkb_action_type { ACTION_TYPE_NONE = 0, @@ -358,8 +362,9 @@ struct xkb_key { typedef darray(xkb_atom_t) darray_xkb_atom_t; -struct xkb_vmod { +struct xkb_mod { xkb_atom_t name; + enum mod_type type; xkb_mod_mask_t mapping; /* vmod -> real mod mapping */ }; @@ -386,7 +391,7 @@ struct xkb_keymap { darray(struct xkb_sym_interpret) sym_interpret; - darray(struct xkb_vmod) vmods; + darray(struct xkb_mod) mods; /* Number of groups in the key with the most groups. */ xkb_layout_index_t num_groups; -- cgit v1.2.1