darray: fix indentation

Signed-off-by: Ran Benita <ran234@gmail.com>
action: simplify Check* functions

Instead of using those t1 t2 variables, pass the final destinations
directly (while making sure they are not modified in case of error).

This also ensures the types are right, e.g. in CheckGroupField it should
be int32_t, not xkb_layout_index_t (and indeed it takes a negation!).

Signed-off-by: Ran Benita <ran234@gmail.com>
ast: cast to ParseCommon explictly instead of using ->common

Some tools were getting mighty confused with what we were doing.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: fix missing support for "affect" field

Support for setting this field was missing from the LockMods and
LockControls actions.

Based on a xkbcomp patch by Andreas Wettstein.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: move array_ndx errors into the Check functions

Makes more sense and flows more nicely this way.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: add missing array_ndx checks

Only the "data" field can have them, and every other field needs to
error out if it appears. But some didn't check.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: don't pass a keymap where a ctx is sufficient

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

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: unbreak some complex lines

It's very hard to read as-is. Apologies for those reading over a VT100.

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: don't print "affect=lock" in PtrLock

It's the same as no flags, so might as well not print it.
(In fact it is slightly harmful, because it actively *clears* the affect
flags, which might have been set in some other manner. But in practice
this cannot happen).

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap-dump: add missing support for NoLock and NoUnlock flags

Based on a libxkbfile patch by Andreas Wettstein.

Signed-off-by: Ran Benita <ran234@gmail.com>
action: fix SwitchScreen "same" field handling

This used to *unset* a flag called "SwitchApplication"; we changed the
flag to "same" but forgot to switch the cases.

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap: change action flag NO_ACCEL -> ACCEL

It's easier to deal with, but we need to set it as "factory default".

Signed-off-by: Ran Benita <ran234@gmail.com>
action: add a common CheckBooleanFlag function

Signed-off-by: Ran Benita <ran234@gmail.com>
action: unify SetLatch and Lock handler functions

This is a little shorter and follows easier from the spec flag
description table.
Also a few were too permissive (like allowing LatchToLock in SetMods).

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

This retrieves the mask of consumed modifiers for a given key and state,
which is helpful for toolkits without having them to do it one modifier
at a time, or pass in 0xFFFFFFFF to xkb_state_remove_consumed_mods to
"reverse-engineer" the consumed mods.
symbols: fix possible use of uninitialized value

Nothing bad can come out of it, but for some reason this error didn't
return early (inherited from xkbcomp).
Also promote the log message to an error, as it clearly is.

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

Normalize the style and error message levels.

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols, keycodes: fix int return type when bool is intended

Signed-off-by: Ran Benita <ran234@gmail.com>
doc: add comments about update_key() and get_syms() order

I remember we had a comment about this, but I can't find it. So add it
again.

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