From 36bc6cd0952b2eddc17e7da803d85decf96d32cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 28 Sep 2014 03:51:45 +0200 Subject: Move to iconv That is the major change in this commit. Also Ctrl-modified keys now should work in URxvt, which was surprisingly trivial to achieve. Coming up next: - making sure the tests still work - introducing CMake --- demo-async.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'demo-async.c') diff --git a/demo-async.c b/demo-async.c index afe1d24..6efcf28 100644 --- a/demo-async.c +++ b/demo-async.c @@ -3,6 +3,8 @@ #include #include +#include +#include #include "termkey.h" @@ -21,8 +23,9 @@ main (int argc, char *argv[]) (void) argv; TERMKEY_CHECK_VERSION; + setlocale (LC_CTYPE, ""); - termkey_t *tk = termkey_new (0, 0); + termkey_t *tk = termkey_new (STDIN_FILENO, NULL, 0); if (!tk) { @@ -31,7 +34,7 @@ main (int argc, char *argv[]) } struct pollfd fd; - fd.fd = 0; /* the file descriptor we passed to termkey_new() */ + fd.fd = STDIN_FILENO; /* the file descriptor we passed to termkey_new() */ fd.events = POLLIN; termkey_result_t ret; @@ -54,8 +57,8 @@ main (int argc, char *argv[]) { on_key (tk, &key); - if (key.type == TERMKEY_TYPE_UNICODE - && key.modifiers & TERMKEY_KEYMOD_CTRL + if (key.type == TERMKEY_TYPE_KEY + && (key.modifiers & TERMKEY_KEYMOD_CTRL) && (key.code.codepoint == 'C' || key.code.codepoint == 'c')) running = 0; } -- cgit v1.2.3