Modernize struct xkb_mods

Currently xkb_mods has the following members:
- uint8_t real_mods - 8 X11 core mods
- xkb_mod_mask_t vmods - 16 virtual mods, zero-based index
- xkb_mod_mask_t mask - the computed effective *real* modifier mask,
  basically a cache for the first two which is:
  real_mods | real mods computed from vmods

Our API acts on masks which combine the real_mods and vmods into a
single value, which is:
8 first bits real mods | 16 next bits virtual mods
(XkbNumModifiers = 8, XkbNumVirtualMods = 16). This is also the format
which ResolveVModMask uses (which is where all the modifier masks really
"come from", e.g. "Shift+Lock+Level5" -> xkb_mod_mask_t).

What the code does now after getting the mask from ResolveVModMask, is
to break it into real part and virtual part and store them seperately,
and then join them back together when the effective mask is calculated.

This is all pretty useless work. We change xkb_mods to the following:
- xkb_mod_mask_t mods - usually what ResolveVModMask returns
- xkb_mod_mask_t mask - the computed mask cache
And try to consistently use the word "mods" for the original,
non-effective mods and mask for the effective mods (which can only
contain real mods for now, because things break otherwise).

The separation is also made clearer. The effective masks are computed by
UpdateModifiersFromCompat after all the sections have been compiled;
before this the mask field is never touched; after this (i.e. map.c and
state.c) the original mods field is never touched. This single execption
to this rule is keymap-dump.c: it needs to print out only the original
modifiers, not computed ones. This is also the reason why we actually
keep two fields instead keeping one and modifying it in place.

The next logical step is probably to turn the real mods into vmods
themselves, and get rid of the distinction entirely (in a compatible
way).

Signed-off-by: Ran Benita <ran234@gmail.com>
state: use global static const for fake action

Requires constifying some arguments.

Signed-off-by: Ran Benita <ran234@gmail.com>
Use XKB_{GROUP,LEVEL}_INVALID instead of -1 for errors

The group/level types are unsigned, so it's odd to return -1 for them.
Instead use their invalid values (which happen to be == -1).

Signed-off-by: Ran Benita <ran234@gmail.com>
map: share some code

Make more extensive use of get_entry_for_key_state, and add
key_get_consumed to use in the other consume functions.

There's also a slight change in the consumed mods calculations, where
we use entry->mods.mask instead of type->mods.mask. The original was
copied from what libX11 does but what we do now is more logically
correct. The result is exactly the same though because:
type->mods.mask ⊇ entry->mods.mask ⊇ entry->preserve.mask

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove AutoKeyNames feature

If this keymap flag is set, whenever a key name appears in one of the
sections which does not exist (i.e. has not been declared in keycodes),
it finds the first unused keycode and attaches it that name.

This might have been useful when you could compile the symbols section
or geometry section without a keycodes section, but we don't support
this anymore. It's also pretty useless for any real work, because the
user has no way of knowing the keycode and so it will never be used.
Finally the only obscure way left to set this flag is by including a
keycodes file called "computed".

Just remove it.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove left over keycodes.h

For some reason we still track this file in git even though we don't use
it any more.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove xkbcomp/misc.c

The KeyName functions are more appropriate in keycodes.c.
The ProcessIncludeFile can go to path.c along with the other functions
dealing with includes.

Signed-off-by: Ran Benita <ran234@gmail.com>
keycodes: save context in Info, not keymap

We don't need the keymap in this case, just makes things more verbose.

Signed-off-by: Ran Benita <ran234@gmail.com>
Store actions inside struct xkb_key

Cuts out a lot of useless redirection and space.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove XkbKeyTypeIndex and widen index type

We don't need the macro, and using char for the kt_index is imaginably
too small.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: get rid of xkb_any_action

And use union xkb_action instead. We add xkb_private_action, which is
the same as xkb_any_action, but only used where the intention is clear.
This should take care of whatever sizing changes the action struct might
have.

Signed-off-by: Ran Benita <ran234@gmail.com>
Combine a couple of macros

Easier to see what it does without the trivial macros.

Signed-off-by: Ran Benita <ran234@gmail.com>
Move 'no symbols defined for ...' message to a warning

Shut up shut up shut up shut up shut up shut up.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>