vmod: remove unused fields

Signed-off-by: Ran Benita <ran234@gmail.com>
Replace more defines with enums

Mostly the ones used to track the fields of types/keys/leds which were
already defined.

Signed-off-by: Ran Benita <ran234@gmail.com>
keyseq: use our own keysyms

Instead of <X11/keysym.h>

Signed-off-by: Ran Benita <ran234@gmail.com>
interactive: add support to run from keymap file

This is useful for quickly testing a random keymap file. Use -k <PATH>.

Signed-off-by: Ran Benita <ran234@gmail.com>
types: don't use canonical/required types

Xkb required every keymap to have at least the four following canonical
types: ONE_LEVEL, TWO_LEVEL, ALPHABETIC, KEYPAD. This is specified in
e.g. the kbproto spec and XkbKeyTypesForCoreSymbols(3) man page.

If these types are not specified in the keymap, the code specifically
checks for them and adds them to the 4 first places in the types array,
such that they exist in every keymap. These are also the types (along
with some non-required 4-level ones) that are automatically assigned to
keys which do not explicitly declare a type (see FindAutomaticType in
symbols.c, this commit doesn't touch these heuristics, whcih are also not
very nice but necessary).

The xkeyboard-config does not rely on the builtin xkbcomp definitions of
these types and does specify them explicitly, in types/basic and
types/numpad, which are virtually always included.

This commit removes the special behavior:
- The code is ugly and makes keytypes.c harder to read.
- The code practically never gets run - everyone who uses
  xkeyboard-config or a keymap based upon it (i.e. everyone) doesn't need
  it. So it doesn't get tested.
- It mixes policy with implementation for not very good reasons, it
  seems mostly for default compatibility with X11 core.
- And of course we don't need to remain compatible with Xkb ABI neither.

Instead, if we read a keymap with no types specified at all, we simply
assign all keys a default one-level type (like ONE_LEVEL), and issue
plenty of warnings to make it clear (with verbosity >= 3). Note that
this default can actually be changed from within the keymap, by writing
something like
    type.modifier = Shift
    type.whatever_field = value
in the top level of the xkb_types section. (This functionality is
completely unused as well today, BTW, but makes some sense).

This change means that if someone writes a keymap from scratch and
doesn't add say ALPHABETIC, then something like <AE11> = { [ q Q ]; }; will
ignore the second level. But as stated above this should never happen.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove xproto build dependency

Very little left to do for this.

Signed-off-by: Ran Benita <ran234@gmail.com>
darray: fix formatting

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: clean up write_buf function

It would have been nice to use open_memstream here if it was portable
enough (maybe someday it will?).

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: use SITextMatch

text.c has the exact same function.

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: use ActionTypeText

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: constify function arguments

We need this for later.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: drop global actionInitialized

The action.c needs to use two constant Expr values, constTrue and
constFalse. To do this is keeps to static globals Expr's of type boolean
and the values "true" and "false" which need to be interned (and thus
context specific). The interning means they can't be made static const,
so there's a global flag and initializer function.

Instead of using this unsafe global state, we can simply use an integer
boolean expression (1 and 0) instead of a string one ("true" and
"false") and make them const.

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: remove support for key behaviors

The possible key behaviors are:
KB_RadioGroup, KB_Overlay1, KB_Overlay2: already removed support for
these.
KB_Lock (with or without KB_Permanent): used to ignore key presses or
releases to simulate and deal with some legacy keyboard behaviors
(like keys that physically lock). Not used at all.

We already ignore them while processing key events in state.c, so make
it official.

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