X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Ftest_input.c;h=7dc06c7c721913137e9c7b1355b0dc1aecef46ce;hb=4962213bace101fd2861c19cc0e4c057b15a2030;hp=495c70ee94aa8593a5cd068e4d80fa934dc817a7;hpb=5f348ccec7f96e58c15dca35ba2af5e8e4e8ba34;p=platform%2Fupstream%2Fkmscon.git diff --git a/tests/test_input.c b/tests/test_input.c index 495c70e..7dc06c7 100644 --- a/tests/test_input.c +++ b/tests/test_input.c @@ -39,7 +39,7 @@ static void print_help(); #include #include #include "eloop.h" -#include "log.h" +#include "shl_log.h" #include "uterm_input.h" #include "uterm_monitor.h" #include "test_include.h" @@ -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 [-] Set XkbModel for input devices\n" "\t --xkb-layout [-] Set XkbLayout for input devices\n" "\t --xkb-variant [-] Set XkbVariant for input devices\n" - "\t --xkb-options [-] Set XkbOptions for input devices\n", + "\t --xkb-options [-] Set XkbOptions for input devices\n" + "\t --xkb-keymap [-] 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)