commands/input: perform basic keymap validation

Before the delta input config is stored, this attempts to compile a
keymap with it. If the keymap fails to compile, then the first line of
the xkbcommon log entry will be included with a `CMD_FAILURE`, the
entire xkbcommon log entry will be included in the sway error log, and
the delta will not be stored.

This only handles basic issues such as a layouts not existing. This
will NOT catch more complex issues such as when a variant does
exist, but not for the given layout (ex: `azerty` is a valid variant,
but the `us` layout does not have a `azerty` variant).
This commit is contained in:
Brian Ashworth 2019-05-23 03:06:28 -04:00 committed by Simon Ser
parent 4d93b96b6e
commit be2d2a299a
3 changed files with 61 additions and 4 deletions

View file

@ -65,7 +65,8 @@ struct sway_keyboard {
struct sway_binding *repeat_binding;
};
struct xkb_keymap *sway_keyboard_compile_keymap(struct input_config *ic);
struct xkb_keymap *sway_keyboard_compile_keymap(struct input_config *ic,
char **error);
struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
struct sway_seat_device *device);