mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-20 13:56:35 +02:00
Merge branch 'master' of https://github.com/Tox/toxic
This commit is contained in:
304
src/audio_call.c
304
src/audio_call.c
@ -27,16 +27,17 @@ typedef struct _DeviceIx {
|
||||
|
||||
ALCdevice* dhndl; /* Handle of device selected/opened */
|
||||
ALCcontext* ctx; /* Device context */
|
||||
const char* devices[MAX_DEVICES]; /* Container */
|
||||
int size;
|
||||
const char* devices[MAX_DEVICES]; /* Container of available devices */
|
||||
int size; /* Size of above container */
|
||||
int dix; /* Index of default device */
|
||||
int index; /* Current index */
|
||||
} DeviceIx;
|
||||
|
||||
typedef enum _devices
|
||||
typedef enum _Devices
|
||||
{
|
||||
input,
|
||||
output,
|
||||
} _devices;
|
||||
} _Devices;
|
||||
|
||||
struct _ASettings {
|
||||
|
||||
@ -61,9 +62,115 @@ void callback_call_canceled ( void *arg );
|
||||
void callback_call_rejected ( void *arg );
|
||||
void callback_call_ended ( void *arg );
|
||||
void callback_requ_timeout ( void *arg );
|
||||
void callback_peer_timeout ( void* arg );
|
||||
|
||||
|
||||
/* Opens device under current index
|
||||
*/
|
||||
int device_open (WINDOW *window, _Devices type)
|
||||
{
|
||||
/* Do not error if no device */
|
||||
if ( !ASettins.device[type].size ) return 0;
|
||||
|
||||
ALCdevice* prev_device = ASettins.device[type].dhndl;
|
||||
|
||||
const char* error = NULL;
|
||||
|
||||
if ( type == input ) {
|
||||
ASettins.device[type].dhndl = alcCaptureOpenDevice(
|
||||
ASettins.device[type].devices[ASettins.device[type].index], AUDIO_SAMPLE_RATE, AL_FORMAT_MONO16, AUDIO_FRAME_SIZE * 4);
|
||||
|
||||
if (alcGetError(ASettins.device[type].dhndl) != AL_NO_ERROR) {
|
||||
|
||||
/* Now check if we have previous device and act acording to it */
|
||||
if ( !prev_device ) {
|
||||
error = "Error starting input device!";
|
||||
|
||||
ASettins.errors |= ErrorStartingCaptureDevice;
|
||||
}
|
||||
else {
|
||||
error = "Could not start input device, falling back to previous";
|
||||
|
||||
/* NOTE: What if device is opened? */
|
||||
ASettins.device[type].dhndl = prev_device;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Close previous */
|
||||
if ( prev_device )
|
||||
alcCaptureCloseDevice(prev_device);
|
||||
|
||||
if ( window ) wprintw(window, "Input device: %s\n", ASettins.device[type].devices[ASettins.device[type].index]);
|
||||
}
|
||||
|
||||
ASettins.device[type].ctx = NULL;
|
||||
}
|
||||
else {
|
||||
ASettins.device[type].dhndl = alcOpenDevice(ASettins.device[type].devices[ASettins.device[type].index]);
|
||||
|
||||
if (alcGetError(ASettins.device[type].dhndl) != AL_NO_ERROR) {
|
||||
|
||||
/* Now check if we have previous device and act acording to it */
|
||||
if ( !prev_device ) {
|
||||
error = "Error starting output device!";
|
||||
|
||||
ASettins.errors |= ErrorStartingOutputDevice;
|
||||
ASettins.device[type].ctx = NULL;
|
||||
}
|
||||
else {
|
||||
error = "Could not start output device, falling back to previous";
|
||||
|
||||
/* NOTE: What if device is opened? */
|
||||
ASettins.device[type].dhndl = prev_device;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
/* Close previous */
|
||||
if ( prev_device ) {
|
||||
alcCaptureCloseDevice(prev_device);
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(ASettins.device[type].ctx);
|
||||
}
|
||||
|
||||
ASettins.device[type].ctx = alcCreateContext(ASettins.device[type].dhndl, NULL);
|
||||
|
||||
if ( window ) wprintw(window, "Output device: %s\n", ASettins.device[type].devices[ASettins.device[type].index]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( error ) {
|
||||
if ( window ) wprintw(window, "Error: %s\n", error);
|
||||
return -1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
int device_close (WINDOW *window, _Devices type)
|
||||
{
|
||||
const char* device = NULL;
|
||||
|
||||
if ( ASettins.device[type].dhndl ) {
|
||||
if (type == input) {
|
||||
alcCaptureCloseDevice(ASettins.device[type].dhndl);
|
||||
device = "input";
|
||||
}
|
||||
else {
|
||||
alcCloseDevice(ASettins.device[type].dhndl);
|
||||
alcMakeContextCurrent(NULL);
|
||||
|
||||
if ( ASettins.device[type].ctx )
|
||||
alcDestroyContext(ASettins.device[type].ctx);
|
||||
|
||||
device = "output";
|
||||
}
|
||||
|
||||
ASettins.device[type].index = ASettins.device[type].dix;
|
||||
}
|
||||
|
||||
if ( window && device ) wprintw(window, "Closed %s device\n", device);
|
||||
}
|
||||
|
||||
|
||||
ToxAv* init_audio(ToxWindow* window, Tox* tox)
|
||||
@ -71,7 +178,7 @@ ToxAv* init_audio(ToxWindow* window, Tox* tox)
|
||||
ASettins.errors = NoError;
|
||||
ASettins.ttas = 0; /* Not running */
|
||||
|
||||
/* Capture device */
|
||||
/* Capture devices */
|
||||
const char* stringed_device_list = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
|
||||
ASettins.device[input].size = 0;
|
||||
|
||||
@ -82,32 +189,14 @@ ToxAv* init_audio(ToxWindow* window, Tox* tox)
|
||||
ASettins.device[input].devices[ASettins.device[input].size] = stringed_device_list;
|
||||
|
||||
if ( strcmp( default_device , ASettins.device[input].devices[ASettins.device[input].size] ) == 0 )
|
||||
ASettins.device[input].dix = ASettins.device[input].size;
|
||||
ASettins.device[input].index = ASettins.device[input].dix = ASettins.device[input].size;
|
||||
|
||||
stringed_device_list += strlen( stringed_device_list ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ASettins.device[input].size ) { /* Have device */
|
||||
ASettins.device[input].dhndl = alcCaptureOpenDevice(
|
||||
ASettins.device[input].devices[ASettins.device[input].dix], AUDIO_SAMPLE_RATE, AL_FORMAT_MONO16, AUDIO_FRAME_SIZE * 4);
|
||||
|
||||
if (alcGetError(ASettins.device[input].dhndl) != AL_NO_ERROR) {
|
||||
ASettins.errors |= ErrorStartingCaptureDevice;
|
||||
}
|
||||
|
||||
wprintw(window->window, "Input device: %s\n", ASettins.device[input].devices[ASettins.device[input].dix]);
|
||||
} else { /* No device */
|
||||
wprintw(window->window, "No input device!\n");
|
||||
ASettins.device[input].dhndl = NULL;
|
||||
}
|
||||
|
||||
ASettins.device[input].ctx = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Output device */
|
||||
/* Output devices */
|
||||
stringed_device_list = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
ASettins.device[output].size = 0;
|
||||
|
||||
@ -118,65 +207,49 @@ ToxAv* init_audio(ToxWindow* window, Tox* tox)
|
||||
ASettins.device[output].devices[ASettins.device[output].size] = stringed_device_list;
|
||||
|
||||
if ( strcmp( default_device , ASettins.device[output].devices[ASettins.device[output].size] ) == 0 )
|
||||
ASettins.device[output].dix = ASettins.device[output].size;
|
||||
ASettins.device[output].index = ASettins.device[output].dix = ASettins.device[output].size;
|
||||
|
||||
stringed_device_list += strlen( stringed_device_list ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ASettins.device[output].size ) { /* Have device */
|
||||
ASettins.device[output].dhndl = alcOpenDevice(ASettins.device[output].devices[ASettins.device[output].dix]);
|
||||
|
||||
if (alcGetError(ASettins.device[output].dhndl) != AL_NO_ERROR) {
|
||||
ASettins.errors |= ErrorStartingOutputDevice;
|
||||
}
|
||||
|
||||
wprintw(window->window, "Output device: %s\n", ASettins.device[output].devices[ASettins.device[output].dix]);
|
||||
ASettins.device[output].ctx = alcCreateContext(ASettins.device[output].dhndl, NULL);
|
||||
} else { /* No device */
|
||||
wprintw(window->window, "No output device!\n");
|
||||
ASettins.device[output].dhndl = NULL;
|
||||
ASettins.device[output].ctx = NULL;
|
||||
if (!ASettins.device[input].size && !ASettins.device[output].size) {
|
||||
wprintw(window->window, "No devices: disabling audio!\n");
|
||||
ASettins.av = NULL;
|
||||
}
|
||||
else {
|
||||
/* Streaming stuff from core */
|
||||
ASettins.av = toxav_new(tox, 0, 0);
|
||||
|
||||
if ( !ASettins.av ) {
|
||||
ASettins.errors |= ErrorStartingCoreAudio;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toxav_register_callstate_callback(callback_call_started, av_OnStart, window);
|
||||
toxav_register_callstate_callback(callback_call_canceled, av_OnCancel, window);
|
||||
toxav_register_callstate_callback(callback_call_rejected, av_OnReject, window);
|
||||
toxav_register_callstate_callback(callback_call_ended, av_OnEnd, window);
|
||||
toxav_register_callstate_callback(callback_recv_invite, av_OnInvite, window);
|
||||
|
||||
toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging, window);
|
||||
toxav_register_callstate_callback(callback_recv_starting, av_OnStarting, window);
|
||||
toxav_register_callstate_callback(callback_recv_ending, av_OnEnding, window);
|
||||
|
||||
toxav_register_callstate_callback(callback_recv_error, av_OnError, window);
|
||||
toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, window);
|
||||
toxav_register_callstate_callback(callback_peer_timeout, av_OnPeerTimeout, window);
|
||||
}
|
||||
|
||||
|
||||
/* Streaming stuff from core */
|
||||
ASettins.av = toxav_new(tox, 0, 0);
|
||||
|
||||
if ( !ASettins.av ) {
|
||||
ASettins.errors |= ErrorStartingCoreAudio;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toxav_register_callstate_callback(callback_call_started, av_OnStart, window);
|
||||
toxav_register_callstate_callback(callback_call_canceled, av_OnCancel, window);
|
||||
toxav_register_callstate_callback(callback_call_rejected, av_OnReject, window);
|
||||
toxav_register_callstate_callback(callback_call_ended, av_OnEnd, window);
|
||||
toxav_register_callstate_callback(callback_recv_invite, av_OnInvite, window);
|
||||
|
||||
toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging, window);
|
||||
toxav_register_callstate_callback(callback_recv_starting, av_OnStarting, window);
|
||||
toxav_register_callstate_callback(callback_recv_ending, av_OnEnding, window);
|
||||
|
||||
toxav_register_callstate_callback(callback_recv_error, av_OnError, window);
|
||||
toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, window);
|
||||
|
||||
return ASettins.av;
|
||||
}
|
||||
|
||||
void terminate_audio()
|
||||
{
|
||||
if ( ASettins.device[input].dhndl ) {
|
||||
alcCaptureCloseDevice(ASettins.device[input].dhndl);
|
||||
}
|
||||
stop_transmission();
|
||||
|
||||
if ( ASettins.device[output].dhndl ) {
|
||||
alcCloseDevice(ASettins.device[output].dhndl);
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(ASettins.device[output].ctx);
|
||||
}
|
||||
|
||||
toxav_kill(ASettins.av);
|
||||
if ( ASettins.av )
|
||||
toxav_kill(ASettins.av);
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +267,10 @@ int errors()
|
||||
void* transmission(void* arg)
|
||||
{
|
||||
(void)arg; /* Avoid warning */
|
||||
|
||||
|
||||
/* Missing audio support */
|
||||
if ( !ASettins.av ) _cbend;
|
||||
|
||||
ASettins.ttas = 1;
|
||||
|
||||
/* Prepare devices */
|
||||
@ -289,17 +365,27 @@ cleanup:
|
||||
|
||||
alDeleteSources(1, &source);
|
||||
alDeleteBuffers(openal_buffers, buffers);
|
||||
alcMakeContextCurrent(NULL);
|
||||
|
||||
|
||||
device_close(NULL, input);
|
||||
device_close(NULL, output);
|
||||
|
||||
_cbend;
|
||||
}
|
||||
|
||||
int start_transmission()
|
||||
{
|
||||
if ( !ASettins.av ) return -1;
|
||||
|
||||
if ( !toxav_capability_supported(ASettins.av, AudioDecoding) ||
|
||||
!toxav_capability_supported(ASettins.av, AudioEncoding) )
|
||||
return -1;
|
||||
|
||||
/* Now open our devices */
|
||||
if ( -1 == device_open(NULL, input) )
|
||||
return -1;
|
||||
if ( -1 == device_open(NULL, output))
|
||||
return -1;
|
||||
|
||||
/* Don't provide support for video */
|
||||
toxav_prepare_transmission(ASettins.av, 0);
|
||||
|
||||
@ -356,6 +442,9 @@ void callback_call_started ( void* arg )
|
||||
void callback_call_canceled ( void* arg )
|
||||
{
|
||||
CB_BODY(arg, onCancel);
|
||||
|
||||
/* In case call is active */
|
||||
stop_transmission();
|
||||
}
|
||||
void callback_call_rejected ( void* arg )
|
||||
{
|
||||
@ -369,9 +458,17 @@ void callback_call_ended ( void* arg )
|
||||
|
||||
void callback_requ_timeout ( void* arg )
|
||||
{
|
||||
CB_BODY(arg, onTimeout);
|
||||
CB_BODY(arg, onRequestTimeout);
|
||||
}
|
||||
void callback_peer_timeout ( void* arg )
|
||||
{
|
||||
CB_BODY(arg, onPeerTimeout);
|
||||
stop_transmission();
|
||||
/* Call is stopped manually since there might be some other
|
||||
* actions that one can possibly take on timeout
|
||||
*/
|
||||
toxav_stop_call(ASettins.av);
|
||||
}
|
||||
|
||||
/*
|
||||
* End of Callbacks
|
||||
*/
|
||||
@ -386,7 +483,7 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
|
||||
if (argc != 0) { error_str = "Invalid syntax!"; goto on_error; }
|
||||
|
||||
if ( !ASettins.av ) { error_str = "No audio supported!"; goto on_error; }
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_call(ASettins.av, self->num, TypeAudio, 30);
|
||||
|
||||
@ -410,7 +507,7 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if (argc != 0) { error_str = "Invalid syntax!"; goto on_error; }
|
||||
|
||||
if ( !ASettins.av ) { error_str = "No audio supported!"; goto on_error; }
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_answer(ASettins.av, TypeAudio);
|
||||
|
||||
@ -435,7 +532,7 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if (argc != 0) { error_str = "Invalid syntax!"; goto on_error; }
|
||||
|
||||
if ( !ASettins.av ) { error_str = "No audio supported!"; goto on_error; }
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_hangup(ASettins.av);
|
||||
|
||||
@ -458,7 +555,7 @@ void cmd_cancel(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
if (argc != 0) { error_str = "Invalid syntax!"; goto on_error; }
|
||||
|
||||
if ( !ASettins.av ) { error_str = "No audio supported!"; goto on_error; }
|
||||
if ( !ASettins.av ) { error_str = "Audio not supported!"; goto on_error; }
|
||||
|
||||
ToxAvError error = toxav_hangup(ASettins.av);
|
||||
|
||||
@ -488,7 +585,7 @@ void cmd_list_devices(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
_devices type;
|
||||
_Devices type;
|
||||
|
||||
if ( strcmp(argv[1], "in") == 0 ) /* Input devices */
|
||||
type = input;
|
||||
@ -527,7 +624,7 @@ void cmd_change_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
_devices type;
|
||||
_Devices type;
|
||||
|
||||
if ( strcmp(argv[1], "in") == 0 ) /* Input devices */
|
||||
type = input;
|
||||
@ -553,46 +650,9 @@ void cmd_change_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (
|
||||
error_str = "No device with such index";
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
/* Close default device */
|
||||
if ( ASettins.device[type].dhndl ) {
|
||||
alcCloseDevice(ASettins.device[type].dhndl);
|
||||
|
||||
if ( ASettins.device[type].ctx) { /* Output device has context with it */
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(ASettins.device[type].ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/* Open new device */
|
||||
|
||||
if ( type == input ) {
|
||||
ASettins.device[input].dhndl = alcCaptureOpenDevice(
|
||||
ASettins.device[input].devices[selection], AUDIO_SAMPLE_RATE, AL_FORMAT_MONO16, AUDIO_FRAME_SIZE * 4);
|
||||
|
||||
if (alcGetError(ASettins.device[input].dhndl) != AL_NO_ERROR) {
|
||||
error_str = "Error starting input device!";
|
||||
ASettins.errors |= ErrorStartingCaptureDevice;
|
||||
}
|
||||
|
||||
ASettins.device[input].ctx = NULL;
|
||||
|
||||
wprintw(window, "Input device: %s\n", ASettins.device[type].devices[selection]);
|
||||
}
|
||||
else {
|
||||
ASettins.device[output].dhndl = alcOpenDevice(ASettins.device[output].devices[selection]);
|
||||
|
||||
if (alcGetError(ASettins.device[output].dhndl) != AL_NO_ERROR) {
|
||||
error_str = "Error starting output device!";
|
||||
ASettins.errors |= ErrorStartingOutputDevice;
|
||||
}
|
||||
|
||||
ASettins.device[output].ctx = alcCreateContext(ASettins.device[output].dhndl, NULL);
|
||||
|
||||
wprintw(window, "Output device: %s\n", ASettins.device[type].devices[selection]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ASettins.device[type].index = selection;
|
||||
wprintw(window, "Selected: %s\n", ASettins.device[type].devices[selection]);
|
||||
|
||||
return;
|
||||
on_error:
|
||||
|
17
src/chat.c
17
src/chat.c
@ -443,16 +443,26 @@ void chat_onEnd (ToxWindow *self, ToxAv *av)
|
||||
|
||||
wprintw(ctx->history, "Call ended! \n");
|
||||
}
|
||||
void chat_onTimeout (ToxWindow *self, ToxAv *av)
|
||||
void chat_onRequestTimeout (ToxWindow *self, ToxAv *av)
|
||||
{
|
||||
if (self->num != toxav_get_peer_id(av, 0))
|
||||
return;
|
||||
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
|
||||
wprintw(ctx->history, "No answer! \n");
|
||||
}
|
||||
|
||||
void chat_onPeerTimeout (ToxWindow *self, ToxAv *av)
|
||||
{
|
||||
if (self->num != toxav_get_peer_id(av, 0))
|
||||
return;
|
||||
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
wprintw(ctx->history, "Peer disconnected; call ended! \n");
|
||||
}
|
||||
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
||||
static void send_action(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t *action) {
|
||||
@ -856,7 +866,8 @@ ToxWindow new_chat(Tox *m, int friendnum)
|
||||
ret.onCancel = &chat_onCancel;
|
||||
ret.onReject = &chat_onReject;
|
||||
ret.onEnd = &chat_onEnd;
|
||||
ret.onTimeout = &chat_onTimeout;
|
||||
ret.onRequestTimeout = &chat_onRequestTimeout;
|
||||
ret.onPeerTimeout = &chat_onPeerTimeout;
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
||||
uint8_t name[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||
|
@ -34,7 +34,10 @@
|
||||
#include "chat.h"
|
||||
#include "friendlist.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
#include "audio_call.h"
|
||||
#endif
|
||||
|
||||
extern char *DATA_FILE;
|
||||
extern ToxWindow *prompt;
|
||||
@ -578,7 +581,8 @@ ToxWindow new_friendlist(void)
|
||||
ret.onCancel = &friendlist_onAv;
|
||||
ret.onReject = &friendlist_onAv;
|
||||
ret.onEnd = &friendlist_onAv;
|
||||
ret.onTimeout = &friendlist_onAv;
|
||||
ret.onRequestTimeout = &friendlist_onAv;
|
||||
ret.onPeerTimeout = &friendlist_onAv;
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
||||
strcpy(ret.name, "friends");
|
||||
|
@ -412,7 +412,7 @@ void exit_toxic(Tox *m)
|
||||
free(prompt->promptbuf);
|
||||
tox_kill(m);
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
terminate_audio(prompt, av);
|
||||
terminate_audio();
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
endwin();
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -121,7 +121,8 @@ struct ToxWindow {
|
||||
void(*onCancel)(ToxWindow *, ToxAv *);
|
||||
void(*onReject)(ToxWindow *, ToxAv *);
|
||||
void(*onEnd)(ToxWindow *, ToxAv *);
|
||||
void(*onTimeout)(ToxWindow *, ToxAv *);
|
||||
void(*onRequestTimeout)(ToxWindow *, ToxAv *);
|
||||
void(*onPeerTimeout)(ToxWindow *, ToxAv *);
|
||||
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
||||
|
@ -393,14 +393,15 @@ void draw_active_window(Tox *m)
|
||||
|
||||
/* Handle input */
|
||||
#ifdef HAVE_WIDECHAR
|
||||
wget_wch(stdscr, &ch);
|
||||
if (wget_wch(stdscr, &ch) == ERR)
|
||||
#else
|
||||
ch = getch();
|
||||
if ((ch = getch()) == ERR)
|
||||
#endif
|
||||
return;
|
||||
|
||||
if (ch == T_KEY_NEXT || ch == T_KEY_PREV) {
|
||||
set_next_window((int) ch);
|
||||
} else if (ch != ERR) {
|
||||
} else {
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
a->onKey(a, m, ch);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
Reference in New Issue
Block a user