mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-13 02:13:02 +01:00
Make wide character support optional
Issue #514. FindCursesw modified to make it simpler. Wide character can be disable by passing NO_WIDECHAR=ON.
This commit is contained in:
parent
30666d2deb
commit
1087bbb4ff
@ -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;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define _XOPEN_SOURCE_EXTENDED
|
||||
#include <curses.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -4,7 +4,6 @@
|
||||
#ifndef _windows_h
|
||||
#define _windows_h
|
||||
|
||||
#define _XOPEN_SOURCE_EXTENDED
|
||||
#include <curses.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user