expo: Implement the keypress logic for popup menus
In 'popup' mode, the expo allows moving around the objects in a scene.
When 'enter' is pressed on a menu, it opens and the user can move around
the items in the menu.
Implement this using keypress handles and actions.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index 6aab276..dfe5692 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -323,6 +323,7 @@
int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key,
struct expo_action *event)
{
+ const bool open = menu->obj.flags & SCENEOF_OPEN;
struct scene_menitem *item, *cur, *key_item;
cur = NULL;
@@ -367,8 +368,13 @@
log_debug("select item %d\n", event->select.id);
break;
case BKEY_QUIT:
- event->type = EXPOACT_QUIT;
- log_debug("quit\n");
+ if (scn->expo->popup && open) {
+ event->type = EXPOACT_CLOSE;
+ event->select.id = menu->obj.id;
+ } else {
+ event->type = EXPOACT_QUIT;
+ log_debug("menu quit\n");
+ }
break;
case '0'...'9':
key_item = scene_menu_find_key(scn, menu, key);