
From: Simon Glass <sjg@chromium.org> In preparation for supporting mouse clicks, split the key-handling part of this function into a separate poll_keys() function. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/expo.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index b4fa4fdd488..f9573858082 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -382,9 +382,9 @@ int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter, return 0; } -int expo_poll(struct expo *exp, struct expo_action *act) +static int poll_keys(struct expo *exp) { - int ichar, key, ret; + int ichar, key; ichar = cli_ch_process(&exp->cch, 0); if (!ichar) { @@ -407,10 +407,17 @@ int expo_poll(struct expo *exp, struct expo_action *act) if (key == BKEY_NONE || key >= BKEY_FIRST_EXTRA) key = ichar; } - if (!key) - return -EAGAIN; - ret = expo_send_key(exp, key); + return key ? key : -EAGAIN; +} + +int expo_poll(struct expo *exp, struct expo_action *act) +{ + int key, ret = -EAGAIN; + + key = poll_keys(exp); + if (key != -EAGAIN) + ret = expo_send_key(exp, key); if (ret) return log_msg_ret("epk", ret); ret = expo_action_get(exp, act); -- 2.43.0