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:
Simon Glass
2025-10-09 06:12:57 -06:00
parent 7f68ca8abc
commit 6b1c188336

View File

@@ -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);
}