From 1087bbb4ffd8b58651631257b6867ba7e9c2c99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Arg=C3=BCelles?= Date: Thu, 22 Aug 2013 15:57:34 -0500 Subject: [PATCH] Make wide character support optional Issue #514. FindCursesw modified to make it simpler. Wide character can be disable by passing NO_WIDECHAR=ON. --- src/chat.c | 4 ++++ src/main.c | 1 - src/toxic_windows.h | 1 - src/windows.c | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/chat.c b/src/chat.c index 41dab99..78316a7 100644 --- a/src/chat.c +++ b/src/chat.c @@ -182,7 +182,11 @@ static void chat_onKey(ToxWindow *self, Messenger *m, wint_t key) getmaxyx(self->window, y2, x2); /* Add printable chars to buffer and print on input space */ +#if HAVE_WIDECHAR if (iswprint(key)) { +#else + if (isprint(key)) { +#endif if (ctx->pos != sizeof(ctx->line) - 1) { mvwaddstr(self->window, y, x, wc_to_char(key)); ctx->line[ctx->pos++] = key; diff --git a/src/main.c b/src/main.c index 6c31041..119ab99 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,6 @@ #include "config.h" #endif -#define _XOPEN_SOURCE_EXTENDED #include #include #include diff --git a/src/toxic_windows.h b/src/toxic_windows.h index 243d5c6..4b1abf1 100644 --- a/src/toxic_windows.h +++ b/src/toxic_windows.h @@ -4,7 +4,6 @@ #ifndef _windows_h #define _windows_h -#define _XOPEN_SOURCE_EXTENDED #include #include #include diff --git a/src/windows.c b/src/windows.c index aff86b7..5906de9 100644 --- a/src/windows.c +++ b/src/windows.c @@ -234,7 +234,11 @@ void draw_active_window(Messenger *m) a->onDraw(a, m); /* Handle input */ +#ifdef HAVE_WIDECHAR get_wch(&ch); +#else + ch = getch(); +#endif if (ch == '\t' || ch == KEY_BTAB) set_next_window((int) ch);