Commit 9e92319db443b28674c75edac452f5dd3ae264c5

Ran Benita 2013-08-13T18:55:09

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 <ran234@gmail.com>

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