summaryrefslogtreecommitdiff
path: root/boot/scene_menu.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 10:22:59 -0600
committerTom Rini <trini@konsulko.com>2023-07-14 12:54:51 -0400
commit4e64beeba7de7720b42714cbc542c9f7dfbba841 (patch)
treeb5a7950debc4e8682bac5bbb9121c47afdd30863 /boot/scene_menu.c
parent4c87e073a4573159f97eb4ed80ec4088f33c7008 (diff)
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>
Diffstat (limited to 'boot/scene_menu.c')
-rw-r--r--boot/scene_menu.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index 6aab27611d7..dfe5692d6ce 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -323,6 +323,7 @@ static struct scene_menitem *scene_menu_find_key(struct scene *scn,
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 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key,
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);