
From: Simon Glass <sjg@chromium.org> If no key is pressed, check for a mouse click and process that, if available. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/expo.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/boot/expo.c b/boot/expo.c index f9573858082..00924a19d27 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -411,15 +411,42 @@ static int poll_keys(struct expo *exp) return key ? key : -EAGAIN; } +static int poll_mouse(struct expo *exp, int *xp, int *yp) +{ + int ret, x, y; + + if (!exp->mouse_enabled) + return -EAGAIN; + + /* First check if we have a click available */ + ret = mouse_get_click(exp->mouse, &x, &y); + if (ret) + return log_msg_ret("epm", ret); + + *xp = x; + *yp = y; + + return 0; /* Click available */ +} + int expo_poll(struct expo *exp, struct expo_action *act) { int key, ret = -EAGAIN; key = poll_keys(exp); - if (key != -EAGAIN) + if (key != -EAGAIN) { ret = expo_send_key(exp, key); + } else if (IS_ENABLED(CONFIG_MOUSE)) { + int x, y; + + ret = poll_mouse(exp, &x, &y); + if (!ret) + ret = expo_send_click(exp, x, y); + } if (ret) return log_msg_ret("epk", ret); + + /* get the action (either a key or a click) */ ret = expo_action_get(exp, act); if (ret) return log_msg_ret("eag", ret); -- 2.43.0