From ead4bea6a0c5b7df91c609d92d9a9fdfad8319c3 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 13 Aug 2013 18:55:09 +0300 Subject: [PATCH libxkbcommon 2/3] test/interactive: use xkb_state_key_get_one_sym() when there's only 1 Kind of odd, but get_one_sym() will be getting a different behavior. Real life users *should* pick one or the other. Signed-off-by: Ran Benita --- test/interactive.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/interactive.c b/test/interactive.c index f90f6eb..341693f 100644 --- a/test/interactive.c +++ b/test/interactive.c @@ -236,12 +236,19 @@ print_keycode(struct keyboard *kbd, xkb_keycode_t keycode) if (nsyms <= 0) return; - printf("keysyms [ "); - for (i = 0; i < nsyms; i++) { - xkb_keysym_get_name(syms[i], s, sizeof(s)); - printf("%-*s ", (int)sizeof(s), s); + if (nsyms == 1) { + xkb_keysym_t sym = xkb_state_key_get_one_sym(state, keycode); + xkb_keysym_get_name(sym, s, sizeof(s)); + printf("keysym [ %-*s ] ", (int) sizeof(s), s); + } + else { + printf("keysyms [ "); + for (i = 0; i < nsyms; i++) { + xkb_keysym_get_name(syms[i], s, sizeof(s)); + printf("%-*s ", (int) sizeof(s), s); + } + printf("] "); } - printf("] "); /* * Only do this if wchar_t is UCS-4, so we can be lazy and print -- 1.8.3.4