version 1.124, 2017/06/04 09:02:36 |
version 1.125, 2017/06/04 09:22:34 |
|
|
|
|
const struct input_state *state; |
const struct input_state *state; |
|
|
|
struct event timer; |
|
|
/* |
/* |
* All input received since we were last in the ground state. Sent to |
* All input received since we were last in the ground state. Sent to |
* control clients on connection. |
* control clients on connection. |
|
|
/* Transition entry/exit handlers. */ |
/* Transition entry/exit handlers. */ |
static void input_clear(struct input_ctx *); |
static void input_clear(struct input_ctx *); |
static void input_ground(struct input_ctx *); |
static void input_ground(struct input_ctx *); |
|
static void input_enter_dcs(struct input_ctx *); |
static void input_enter_osc(struct input_ctx *); |
static void input_enter_osc(struct input_ctx *); |
static void input_exit_osc(struct input_ctx *); |
static void input_exit_osc(struct input_ctx *); |
static void input_enter_apc(struct input_ctx *); |
static void input_enter_apc(struct input_ctx *); |
|
|
/* dcs_enter state definition. */ |
/* dcs_enter state definition. */ |
static const struct input_state input_state_dcs_enter = { |
static const struct input_state input_state_dcs_enter = { |
"dcs_enter", |
"dcs_enter", |
input_clear, NULL, |
input_enter_dcs, NULL, |
input_state_dcs_enter_table |
input_state_dcs_enter_table |
}; |
}; |
|
|
|
|
return (strcmp(ictx->interm_buf, entry->interm)); |
return (strcmp(ictx->interm_buf, entry->interm)); |
} |
} |
|
|
|
/* |
|
* Timer - if this expires then have been waiting for a terminator for too |
|
* long, so reset to ground. |
|
*/ |
|
static void |
|
input_timer_callback(__unused int fd, __unused short events, void *arg) |
|
{ |
|
struct input_ctx *ictx = arg; |
|
struct window_pane *wp = ictx->wp; |
|
|
|
log_debug("%s: %%%u %s expired" , __func__, wp->id, ictx->state->name); |
|
input_reset(wp, 0); |
|
} |
|
|
|
/* Start the timer. */ |
|
static void |
|
input_start_timer(struct input_ctx *ictx) |
|
{ |
|
struct timeval tv = { .tv_usec = 100000 }; |
|
|
|
event_del(&ictx->timer); |
|
event_add(&ictx->timer, &tv); |
|
} |
|
|
/* Reset cell state to default. */ |
/* Reset cell state to default. */ |
static void |
static void |
input_reset_cell(struct input_ctx *ictx) |
input_reset_cell(struct input_ctx *ictx) |
|
|
|
|
ictx->since_ground = evbuffer_new(); |
ictx->since_ground = evbuffer_new(); |
|
|
|
evtimer_set(&ictx->timer, input_timer_callback, ictx); |
|
|
input_reset(wp, 0); |
input_reset(wp, 0); |
} |
} |
|
|
|
|
{ |
{ |
struct input_ctx *ictx = wp->ictx; |
struct input_ctx *ictx = wp->ictx; |
|
|
|
event_del(&ictx->timer); |
|
|
free(ictx->input_buf); |
free(ictx->input_buf); |
evbuffer_free(ictx->since_ground); |
evbuffer_free(ictx->since_ground); |
|
|
|
|
screen_write_stop(&ictx->ctx); |
screen_write_stop(&ictx->ctx); |
} |
} |
|
|
*ictx->interm_buf = '\0'; |
input_clear(ictx); |
ictx->interm_len = 0; |
|
|
|
*ictx->param_buf = '\0'; |
|
ictx->param_len = 0; |
|
|
|
*ictx->input_buf = '\0'; |
|
ictx->input_len = 0; |
|
|
|
ictx->state = &input_state_ground; |
ictx->state = &input_state_ground; |
ictx->flags = 0; |
ictx->flags = 0; |
} |
} |
|
|
static void |
static void |
input_clear(struct input_ctx *ictx) |
input_clear(struct input_ctx *ictx) |
{ |
{ |
|
event_del(&ictx->timer); |
|
|
*ictx->interm_buf = '\0'; |
*ictx->interm_buf = '\0'; |
ictx->interm_len = 0; |
ictx->interm_len = 0; |
|
|
|
|
static void |
static void |
input_ground(struct input_ctx *ictx) |
input_ground(struct input_ctx *ictx) |
{ |
{ |
|
event_del(&ictx->timer); |
evbuffer_drain(ictx->since_ground, EVBUFFER_LENGTH(ictx->since_ground)); |
evbuffer_drain(ictx->since_ground, EVBUFFER_LENGTH(ictx->since_ground)); |
|
|
if (ictx->input_space > INPUT_BUF_START) { |
if (ictx->input_space > INPUT_BUF_START) { |
|
|
} |
} |
} |
} |
|
|
|
/* DCS string started. */ |
|
static void |
|
input_enter_dcs(struct input_ctx *ictx) |
|
{ |
|
log_debug("%s", __func__); |
|
|
|
input_clear(ictx); |
|
input_start_timer(ictx); |
|
} |
|
|
/* DCS terminator (ST) received. */ |
/* DCS terminator (ST) received. */ |
static int |
static int |
input_dcs_dispatch(struct input_ctx *ictx) |
input_dcs_dispatch(struct input_ctx *ictx) |
|
|
log_debug("%s", __func__); |
log_debug("%s", __func__); |
|
|
input_clear(ictx); |
input_clear(ictx); |
|
input_start_timer(ictx); |
} |
} |
|
|
/* OSC terminator (ST) received. */ |
/* OSC terminator (ST) received. */ |
|
|
log_debug("%s", __func__); |
log_debug("%s", __func__); |
|
|
input_clear(ictx); |
input_clear(ictx); |
|
input_start_timer(ictx); |
} |
} |
|
|
/* APC terminator (ST) received. */ |
/* APC terminator (ST) received. */ |
|
|
log_debug("%s", __func__); |
log_debug("%s", __func__); |
|
|
input_clear(ictx); |
input_clear(ictx); |
|
input_start_timer(ictx); |
} |
} |
|
|
/* Rename terminator (ST) received. */ |
/* Rename terminator (ST) received. */ |