aboutsummaryrefslogtreecommitdiff
path: root/demo-async.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-28 03:51:45 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-28 03:59:12 +0200
commit36bc6cd0952b2eddc17e7da803d85decf96d32cc (patch)
tree23488c213f53db83346d3eaf71cb78d74c42eff0 /demo-async.c
parentcac1f8373bb16aae02ffa80acf8640385bf94591 (diff)
downloadtermo-36bc6cd0952b2eddc17e7da803d85decf96d32cc.tar.gz
termo-36bc6cd0952b2eddc17e7da803d85decf96d32cc.tar.xz
termo-36bc6cd0952b2eddc17e7da803d85decf96d32cc.zip
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
Diffstat (limited to 'demo-async.c')
-rw-r--r--demo-async.c11
1 files changed, 7 insertions, 4 deletions
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 <poll.h>
#include <stdio.h>
+#include <unistd.h>
+#include <locale.h>
#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;
}