summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-01-18 00:14:16 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-01-23 13:51:50 +0100
commit582ee16d316fe14fbdccba2377dc335bd69ae32d (patch)
treea711f5899a7fe86dd822da0eaa38315f5d97ecca
parent9b75aa0b9d298f02b3de515cb236598d5c3faa95 (diff)
test_input: simplify and drop xkbcommon dependency
Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r--Makefile.am7
-rw-r--r--tests/test_input.c19
2 files changed, 5 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 32a3c0e..5da6b42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,9 +101,4 @@ test_terminal_SOURCES = tests/test_terminal.c
test_terminal_LDADD = libkmscon-core.la
test_input_SOURCES = tests/test_input.c
-test_input_LDADD = \
- libkmscon-core.la \
- $(XKBCOMMON_LIBS)
-test_input_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- $(XKBCOMMON_CFLAGS)
+test_input_LDADD = libkmscon-core.la
diff --git a/tests/test_input.c b/tests/test_input.c
index 0d349cc..a4500b2 100644
--- a/tests/test_input.c
+++ b/tests/test_input.c
@@ -32,13 +32,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <wchar.h>
-#include <X11/extensions/XKBcommon.h>
#include <X11/keysym.h>
#include "eloop.h"
#include "input.h"
+#include "kbd.h"
#include "log.h"
static bool terminate;
@@ -86,27 +85,17 @@ static void print_modifiers(unsigned int mods)
static void input_arrived(struct kmscon_input *input,
struct kmscon_input_event *ev, void *data)
{
- int len;
char s[16];
- char utf8[MB_CUR_MAX + 1];
if (ev->unicode == KMSCON_INPUT_INVALID) {
- xkb_keysym_to_string(ev->keysym, s, sizeof(s));
+ kmscon_kbd_keysym_to_string(ev->keysym, s, sizeof(s));
printf("sym %s ", s);
} else {
/*
* Just a proof-of-concept hack. This works because glibc uses
* UTF-32 (= UCS-4) as the internal wchar_t encoding.
*/
- len = wctomb(utf8, (wchar_t)ev->unicode);
- if (len <= 0) {
- log_info("Bad unicode char\n");
- return;
- } else {
- utf8[len] = '\0';
- }
-
- printf("utf8 %s ", utf8);
+ printf("unicode %lc ", ev->unicode);
}
print_modifiers(ev->mods);
}
@@ -118,7 +107,7 @@ int main(int argc, char **argv)
struct kmscon_input *input;
struct kmscon_signal *sigint, *sigquit;
- if (!setlocale(LC_ALL, "en_US.UTF-8")) {
+ if (!setlocale(LC_ALL, "")) {
log_err("Cannot set locale: %m\n");
ret = -EFAULT;
goto err_out;