diff options
author | Ran Benita <ran234@gmail.com> | 2013-03-12 17:31:47 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-03-12 17:31:47 +0100 |
commit | d240c27ecb8c107eb52ab7a80eadbae3dab803e2 (patch) | |
tree | 86cf5213b876850d3e6c2bc6dd00fe95a522d218 /tests | |
parent | e6d0d785436152a12f7ca9f159becba9fa17260d (diff) |
kmscon: add --xkb-keymap option for predefined keymaps
This adds an --xkb-keymap <FILE> option to kmscon. When given, kmscon
will try to compile the keymap from the file before trying the other
options (like the XkbKeymap option in xorg.conf).
This is useful for users who have a customized XKB keymap, which is
usually kept in a single file. Example, in X:
xkbcomp $DISPLAY my_keymap.xkb
Customize my_keymap.xkb to your liking, and then in .xinitrc, or
xorg.conf:
xkbcomp my_keymap.xkb $DISPLAY
Now you can also do this in kmscon.conf.
Additionally, lacking such an option, kmscon is quite difficult to use
without an installed xkeyboard-config package, which provides the
infrastructure for the "rules" configuration mechanism. We might even
want to distribute some plain xkb file as a last ditch, for
robustness, if even the default RMLVO fails... without a keyboard a
terminal is not very useful.
(changed Ran's patch to use *_from_string() instead of *_from_file())
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_input.c | 17 | ||||
-rw-r--r-- | tests/test_vt.c | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_input.c b/tests/test_input.c index 832c3b2..7dc06c7 100644 --- a/tests/test_input.c +++ b/tests/test_input.c @@ -52,6 +52,7 @@ struct { char *xkb_layout; char *xkb_variant; char *xkb_options; + char *xkb_keymap; } input_conf; /* Pressing Ctrl-\ should toggle the capturing. */ @@ -109,16 +110,27 @@ static void monitor_event(struct uterm_monitor *mon, void *data) { int ret; + char *keymap; if (ev->type == UTERM_MONITOR_NEW_SEAT) { if (strcmp(ev->seat_name, "seat0")) return; + keymap = NULL; + if (input_conf.xkb_keymap && *input_conf.xkb_keymap) { + ret = shl_read_file(input_conf.xkb_keymap, &keymap, + NULL); + if (ret) + log_error("cannot read keymap file %s: %d", + input_conf.xkb_keymap, ret); + } + ret = uterm_input_new(&input, eloop, input_conf.xkb_model, input_conf.xkb_layout, input_conf.xkb_variant, input_conf.xkb_options, + keymap, 0, 0); if (ret) return; @@ -166,7 +178,9 @@ static void print_help() "\t --xkb-model <model> [-] Set XkbModel for input devices\n" "\t --xkb-layout <layout> [-] Set XkbLayout for input devices\n" "\t --xkb-variant <variant> [-] Set XkbVariant for input devices\n" - "\t --xkb-options <options> [-] Set XkbOptions for input devices\n", + "\t --xkb-options <options> [-] Set XkbOptions for input devices\n" + "\t --xkb-keymap <FILE> [-] Use a predefined keymap for\n" + "\t input devices\n", "test_input"); /* * 80 char line: @@ -184,6 +198,7 @@ struct conf_option options[] = { CONF_OPTION_STRING(0, "xkb-layout", &input_conf.xkb_layout, ""), CONF_OPTION_STRING(0, "xkb-variant", &input_conf.xkb_variant, ""), CONF_OPTION_STRING(0, "xkb-options", &input_conf.xkb_options, ""), + CONF_OPTION_STRING(0, "xkb-keymap", &input_conf.xkb_keymap, ""), }; int main(int argc, char **argv) diff --git a/tests/test_vt.c b/tests/test_vt.c index 8423f0c..26c5ed6 100644 --- a/tests/test_vt.c +++ b/tests/test_vt.c @@ -113,7 +113,7 @@ int main(int argc, char **argv) if (ret) goto err_exit; - ret = uterm_input_new(&input, eloop, "", "", "", "", 0, 0); + ret = uterm_input_new(&input, eloop, "", "", "", "", "", 0, 0); if (ret) goto err_vtm; |