Allow the caller to detect when a keypress has actually resulted in a change of the item that is pointed to.
Signed-off-by: Simon Glass <s...@chromium.org> --- boot/scene_menu.c | 22 ++++++++++++++++------ include/expo.h | 3 +++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/boot/scene_menu.c b/boot/scene_menu.c index fd16cad6521..fe44bd42133 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -410,6 +410,7 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key, { const bool open = menu->obj.flags & SCENEOF_OPEN; struct scene_menitem *item, *cur, *key_item; + bool changed = false; cur = NULL; key_item = NULL; @@ -433,19 +434,28 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key, struct scene_menitem, sibling)) { item = list_entry(item->sibling.prev, struct scene_menitem, sibling); - event->type = EXPOACT_POINT_ITEM; - event->select.id = item->id; - log_debug("up to item %d\n", event->select.id); + changed = true; } + /* + * issue an event even if the pointer did not move, so the + * caller knows that an attempt was made, e.g. to cancel an + * autoboot timeout + */ + event->type = EXPOACT_POINT_ITEM; + event->select.id = item->id; + event->select.changed = changed; + log_debug("up to item %d\n", event->select.id); break; case BKEY_DOWN: if (!list_is_last(&item->sibling, &menu->item_head)) { item = list_entry(item->sibling.next, struct scene_menitem, sibling); - event->type = EXPOACT_POINT_ITEM; - event->select.id = item->id; - log_debug("down to item %d\n", event->select.id); + changed = true; } + event->type = EXPOACT_POINT_ITEM; + event->select.id = item->id; + event->select.changed = changed; + log_debug("down to item %d\n", event->select.id); break; case BKEY_SELECT: event->type = EXPOACT_SELECT; diff --git a/include/expo.h b/include/expo.h index 5eb3299284c..6acbc54c648 100644 --- a/include/expo.h +++ b/include/expo.h @@ -65,12 +65,15 @@ enum expoact_type { * @type: Action type (EXPOACT_NONE if there is no action) * @select: Used for EXPOACT_POINT_ITEM and EXPOACT_SELECT * @select.id: ID number of the object affected. + * @select.changed: true if the selection has changed since last time (only + * valid for EXPOACT_POINT_ITEM) */ struct expo_action { enum expoact_type type; union { struct { int id; + bool changed; } select; }; }; -- 2.43.0 base-commit: e3ced530e543c9f24cbc66430abc6109ce8df015 branch: expa