expo: Correct key-polling timeout
When a character is received it should reset the timeout, even if the
character does not result in output from cli_ch_process()
Fix this, so that keypresses which consist of escape codes are correctly
interpreted.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a5c5b3b2fb ("expo: Speed up polling the keyboard")
This commit is contained in:
@@ -486,17 +486,17 @@ int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter,
|
||||
|
||||
static int poll_keys(struct expo *exp)
|
||||
{
|
||||
int ichar, key;
|
||||
int ch = 0, ichar, key;
|
||||
|
||||
ichar = cli_ch_process(&exp->cch, 0);
|
||||
if (!ichar) {
|
||||
/* Check once for available input */
|
||||
if (tstc()) {
|
||||
ichar = getchar();
|
||||
ichar = cli_ch_process(&exp->cch, ichar);
|
||||
ch = getchar();
|
||||
ichar = cli_ch_process(&exp->cch, ch);
|
||||
}
|
||||
|
||||
if (!ichar && get_timer(exp->last_key_ms) >= 10)
|
||||
if (!ch && get_timer(exp->last_key_ms) >= 10)
|
||||
ichar = cli_ch_process(&exp->cch, -ETIMEDOUT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user