Cleanup
This commit is contained in:
parent
34bbff2f71
commit
cadc846fd4
37
nncmpp.c
37
nncmpp.c
|
@ -2973,7 +2973,6 @@ static void
|
|||
mpd_on_io_hook (void *user_data, bool outgoing, const char *line)
|
||||
{
|
||||
(void) user_data;
|
||||
|
||||
if (outgoing)
|
||||
debug_tab_push (xstrdup_printf ("<< %s", line), APP_ATTR (OUTGOING));
|
||||
else
|
||||
|
@ -3091,19 +3090,7 @@ signals_setup_handlers (void)
|
|||
// --- Initialisation, event handling ------------------------------------------
|
||||
|
||||
static void
|
||||
app_on_tty_readable (const struct pollfd *fd, void *user_data)
|
||||
{
|
||||
(void) user_data;
|
||||
if (fd->revents & ~(POLLIN | POLLHUP | POLLERR))
|
||||
print_debug ("fd %d: unexpected revents: %d", fd->fd, fd->revents);
|
||||
|
||||
poller_timer_reset (&g.tk_timer);
|
||||
termo_advisereadable (g.tk);
|
||||
|
||||
termo_key_t event;
|
||||
int64_t event_ts = clock_msec (CLOCK_BEST);
|
||||
termo_result_t res;
|
||||
while ((res = termo_getkey (g.tk, &event)) == TERMO_RES_KEY)
|
||||
app_on_tty_event (termo_key_t *event, int64_t event_ts)
|
||||
{
|
||||
// Simple double click detection via release--press delay, only a bit
|
||||
// complicated by the fact that we don't know what's being released
|
||||
|
@ -3113,7 +3100,7 @@ app_on_tty_readable (const struct pollfd *fd, void *user_data)
|
|||
|
||||
int y, x, button, y_last, x_last;
|
||||
termo_mouse_event_t type, type_last;
|
||||
if (termo_interpret_mouse (g.tk, &event, &type, &button, &y, &x))
|
||||
if (termo_interpret_mouse (g.tk, event, &type, &button, &y, &x))
|
||||
{
|
||||
bool double_click = termo_interpret_mouse
|
||||
(g.tk, &last_event, &type_last, NULL, &y_last, &x_last)
|
||||
|
@ -3129,13 +3116,29 @@ app_on_tty_readable (const struct pollfd *fd, void *user_data)
|
|||
else if (type == TERMO_MOUSE_PRESS)
|
||||
last_button = button;
|
||||
}
|
||||
else if (!app_process_termo_event (&event))
|
||||
else if (!app_process_termo_event (event))
|
||||
beep ();
|
||||
|
||||
last_event = event;
|
||||
last_event = *event;
|
||||
last_event_ts = event_ts;
|
||||
}
|
||||
|
||||
static void
|
||||
app_on_tty_readable (const struct pollfd *fd, void *user_data)
|
||||
{
|
||||
(void) user_data;
|
||||
if (fd->revents & ~(POLLIN | POLLHUP | POLLERR))
|
||||
print_debug ("fd %d: unexpected revents: %d", fd->fd, fd->revents);
|
||||
|
||||
poller_timer_reset (&g.tk_timer);
|
||||
termo_advisereadable (g.tk);
|
||||
|
||||
termo_key_t event;
|
||||
int64_t event_ts = clock_msec (CLOCK_BEST);
|
||||
termo_result_t res;
|
||||
while ((res = termo_getkey (g.tk, &event)) == TERMO_RES_KEY)
|
||||
app_on_tty_event (&event, event_ts);
|
||||
|
||||
if (res == TERMO_RES_AGAIN)
|
||||
poller_timer_set (&g.tk_timer, termo_get_waittime (g.tk));
|
||||
else if (res == TERMO_RES_ERROR || res == TERMO_RES_EOF)
|
||||
|
|
Loading…
Reference in New Issue