diff options
author | Manuel Argüelles <manuel.arguelles@gmail.com> | 2013-08-22 15:57:34 -0500 |
---|---|---|
committer | Manuel Argüelles <manuel.arguelles@gmail.com> | 2013-08-22 15:57:34 -0500 |
commit | 7ffa4017aaec8a06c6677686a6928e0e7c896f38 (patch) | |
tree | 3694127a3481ada2c8656a4b15c4cd2defec82d9 /testing/toxic | |
parent | 7719a9ed5807aede732230ad30bc31f536a0c4ae (diff) |
Make wide character support optional
Issue #514. FindCursesw modified to make it simpler. Wide character
can be disable by passing NO_WIDECHAR=ON.
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/CMakeLists.txt | 5 | ||||
-rw-r--r-- | testing/toxic/chat.c | 4 | ||||
-rw-r--r-- | testing/toxic/main.c | 1 | ||||
-rw-r--r-- | testing/toxic/windows.c | 4 | ||||
-rw-r--r-- | testing/toxic/windows.h | 1 |
5 files changed, 13 insertions, 2 deletions
diff --git a/testing/toxic/CMakeLists.txt b/testing/toxic/CMakeLists.txt index 53316afb..b59cb55e 100644 --- a/testing/toxic/CMakeLists.txt +++ b/testing/toxic/CMakeLists.txt | |||
@@ -15,6 +15,11 @@ add_executable(${exe_name} | |||
15 | chat.c | 15 | chat.c |
16 | configdir.c) | 16 | configdir.c) |
17 | 17 | ||
18 | if(CURSES_HAVE_WIDE_CHAR) | ||
19 | add_definitions( -D_XOPEN_SOURCE_EXTENDED ) | ||
20 | add_definitions( -DHAVE_WIDE_CHAR ) | ||
21 | endif() | ||
22 | |||
18 | include_directories(${CURSES_INCLUDE_DIR}) | 23 | include_directories(${CURSES_INCLUDE_DIR}) |
19 | 24 | ||
20 | target_link_libraries(${exe_name} | 25 | target_link_libraries(${exe_name} |
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index c7a0f98e..9454010f 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -182,7 +182,11 @@ static void chat_onKey(ToxWindow *self, Messenger *m, wint_t key) | |||
182 | getmaxyx(self->window, y2, x2); | 182 | getmaxyx(self->window, y2, x2); |
183 | 183 | ||
184 | /* Add printable chars to buffer and print on input space */ | 184 | /* Add printable chars to buffer and print on input space */ |
185 | #if HAVE_WIDECHAR | ||
185 | if (iswprint(key)) { | 186 | if (iswprint(key)) { |
187 | #else | ||
188 | if (isprint(key)) { | ||
189 | #endif | ||
186 | if (ctx->pos != sizeof(ctx->line) - 1) { | 190 | if (ctx->pos != sizeof(ctx->line) - 1) { |
187 | mvwaddstr(self->window, y, x, wc_to_char(key)); | 191 | mvwaddstr(self->window, y, x, wc_to_char(key)); |
188 | ctx->line[ctx->pos++] = key; | 192 | ctx->line[ctx->pos++] = key; |
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 12b529fc..2d4a39ad 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Toxic -- Tox Curses Client | 2 | * Toxic -- Tox Curses Client |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #define _XOPEN_SOURCE_EXTENDED | ||
6 | #include <curses.h> | 5 | #include <curses.h> |
7 | #include <errno.h> | 6 | #include <errno.h> |
8 | #include <stdio.h> | 7 | #include <stdio.h> |
diff --git a/testing/toxic/windows.c b/testing/toxic/windows.c index f50bdc2d..7f547d0a 100644 --- a/testing/toxic/windows.c +++ b/testing/toxic/windows.c | |||
@@ -234,7 +234,11 @@ void draw_active_window(Messenger *m) | |||
234 | a->onDraw(a, m); | 234 | a->onDraw(a, m); |
235 | 235 | ||
236 | /* Handle input */ | 236 | /* Handle input */ |
237 | #ifdef HAVE_WIDECHAR | ||
237 | get_wch(&ch); | 238 | get_wch(&ch); |
239 | #else | ||
240 | ch = getch(); | ||
241 | #endif | ||
238 | 242 | ||
239 | if (ch == '\t' || ch == KEY_BTAB) | 243 | if (ch == '\t' || ch == KEY_BTAB) |
240 | set_next_window((int) ch); | 244 | set_next_window((int) ch); |
diff --git a/testing/toxic/windows.h b/testing/toxic/windows.h index 227040b9..0f3b82bd 100644 --- a/testing/toxic/windows.h +++ b/testing/toxic/windows.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #ifndef _windows_h | 4 | #ifndef _windows_h |
5 | #define _windows_h | 5 | #define _windows_h |
6 | 6 | ||
7 | #define _XOPEN_SOURCE_EXTENDED | ||
8 | #include <curses.h> | 7 | #include <curses.h> |
9 | #include <stdint.h> | 8 | #include <stdint.h> |
10 | #include <stdbool.h> | 9 | #include <stdbool.h> |