diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-05 22:46:21 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-10-06 21:41:59 +0200 |
commit | 424de613af4c0a8121213bbee8c4fdd8364612e5 (patch) | |
tree | 60ccce13d87c24cf7bd1411bf1889bed0830472a /src/keymap.h | |
parent | 1005b320f14339236ff53a07b13d6dcbad52bf19 (diff) | |
download | libxkbcommon-424de613af4c0a8121213bbee8c4fdd8364612e5.tar.gz libxkbcommon-424de613af4c0a8121213bbee8c4fdd8364612e5.tar.bz2 libxkbcommon-424de613af4c0a8121213bbee8c4fdd8364612e5.zip |
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 <ran234@gmail.com>
Diffstat (limited to 'src/keymap.h')
-rw-r--r-- | src/keymap.h | 17 |
1 files changed, 11 insertions, 6 deletions
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; |