Remove the XKB_NUM_VIRTUAL_MODIFIERS limit

Turn the virtual modifiers arrays in the keymap to a single darray,
which doesn't use this limit. The number of virtual modifiers is still
limited by the size of xkb_mod_mask_t, so we make sure not to go over
that.

Signed-off-by: Ran Benita <ran234@gmail.com>
keysym-utf: make keysym->unicode table a bit smaller

Saves a few kbytes, and unlikely to change.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: don't allow "none" in LookupModIndex

LookupModMask handles this before calling LookupModIndex, and the only
other user in symbols.c doesn't handle this return value at all.

Signed-off-by: Ran Benita <ran234@gmail.com>
Omit struct '_Name' from non-recursive struct typedefs

Just a pet peeve.

Signed-off-by: Ran Benita <ran234@gmail.com>
vmod: remove merge argument from HandleVModDef

It's unused and unneeded.

Signed-off-by: Ran Benita <ran234@gmail.com>
state: don't needlessly fetch the xkb_key

It's a leftover.

Signed-off-by: Ran Benita <ran234@gmail.com>
vmod: don't allow to add a vmod with the name of a real mod

Otherwise strange thing might ensue.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove VModInfo for now

VModInfo currently is only used to track which virtual modifiers were
declared in the file which owns the VModInfo. This, in turn, is only
used in ResolveVirtualModifier, which in turn is only used to resolve
the virtualModifier field in an interpret statement (compat.c). In other
words, it is used to ensure that interprets can only use a vmod which
was declared in the same map.

We remove this now, because it doesn't do much and distracts from other
changes; we will later re-add it properly. Specificly, we will make it
so that virtual modifiers are not the exception in that they modify the
keymap directly, instead of keeping the changes in some *Info struct and
commiting them to the keymap at the end of the compilation. (This is bad
because if a vmod is added to the keymap, and then the compilation of
this specific file fails, the change sticks around nonetheless).

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: don't expose LookupModIndex

The Lookup* functions should remain a private implementation detail of
the expr.c file.

Signed-off-by: Ran Benita <ran234@gmail.com>
Don't use shifted virtual modifier masks

Modifier masks can be confusing in some places. For example,
key->vmodmap only contains virtual modifiers, where the first is in
position 0, the second in 1 etc., while normally in a xkb_mod_mask_t the
virtual modifiers start from the 8th (XKB_NUM_CORE_MODS) position. This
happens in some other places as well.

Change all of the masks to be in the usual real+virtual format, and when
we need to access e.g. keymap->vmods we just adjust by
XKB_NUM_CORE_MODS. (This also goes for indexes, e.g.
interpret->virtual_modifier).

This makes this stuff easier to reason about.

Signed-off-by: Ran Benita <ran234@gmail.com>
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>