1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-29 15:06:45 +02:00

Fixed character support

This commit is contained in:
Grayson MacKenzie
2014-03-30 16:40:13 -04:00
parent 1420618eb0
commit cce7892d94
6 changed files with 482 additions and 475 deletions

View File

@ -46,7 +46,7 @@ static int num_active_windows;
void on_request(Tox *m, uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata)
{
int i;
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i].onFriendRequest != NULL)
windows[i].onFriendRequest(&windows[i], m, public_key, data, length);
@ -394,18 +394,30 @@ void draw_active_window(Tox *m)
wrefresh(a->window);
/* Handle input */
bool ltr;
#ifdef HAVE_WIDECHAR
if (wget_wch(stdscr, &ch) == ERR)
int status = wget_wch(stdscr, &ch);
if (status == OK)
ltr = true;
else if (status == KEY_CODE_YES)
ltr = false;
else
return;
#else
if ((ch = getch()) == ERR)
#endif
ch = getch();
if (ch == ERR)
return;
if (ch == T_KEY_NEXT || ch == T_KEY_PREV) {
/* TODO verify if this works */
ltr = isprint(ch);
#endif
if (ltr && (ch == T_KEY_NEXT || ch == T_KEY_PREV) ) {
set_next_window((int) ch);
} else {
pthread_mutex_lock(&Winthread.lock);
a->onKey(a, m, ch);
a->onKey(a, m, ch, ltr);
pthread_mutex_unlock(&Winthread.lock);
}
}