mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:43: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);
|
getmaxyx(self->window, y2, x2);
|
||||||
|
|
||||||
/* Add printable chars to buffer and print on input space */
|
/* Add printable chars to buffer and print on input space */
|
||||||
|
#if HAVE_WIDECHAR
|
||||||
if (iswprint(key)) {
|
if (iswprint(key)) {
|
||||||
|
#else
|
||||||
|
if (isprint(key)) {
|
||||||
|
#endif
|
||||||
if (ctx->pos != sizeof(ctx->line) - 1) {
|
if (ctx->pos != sizeof(ctx->line) - 1) {
|
||||||
mvwaddstr(self->window, y, x, wc_to_char(key));
|
mvwaddstr(self->window, y, x, wc_to_char(key));
|
||||||
ctx->line[ctx->pos++] = key;
|
ctx->line[ctx->pos++] = key;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _XOPEN_SOURCE_EXTENDED
|
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#ifndef _windows_h
|
#ifndef _windows_h
|
||||||
#define _windows_h
|
#define _windows_h
|
||||||
|
|
||||||
#define _XOPEN_SOURCE_EXTENDED
|
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -234,7 +234,11 @@ void draw_active_window(Messenger *m)
|
|||||||
a->onDraw(a, m);
|
a->onDraw(a, m);
|
||||||
|
|
||||||
/* Handle input */
|
/* Handle input */
|
||||||
|
#ifdef HAVE_WIDECHAR
|
||||||
get_wch(&ch);
|
get_wch(&ch);
|
||||||
|
#else
|
||||||
|
ch = getch();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ch == '\t' || ch == KEY_BTAB)
|
if (ch == '\t' || ch == KEY_BTAB)
|
||||||
set_next_window((int) ch);
|
set_next_window((int) ch);
|
||||||
|
Loading…
Reference in New Issue
Block a user