
From: Simon Glass <sjg@chromium.org> Popup menus have particular behaviour which needs to be modelled in the expoact_type enum: - clicking on a menu item should select it and close the menu - clicking on a menu should highlight it and open the menu - clicking on a menu while another menu is open should select the item, close the menu, then open the other menu Add actions associated with each of these. These are modelled as combined actions for simplicity. Implement the actions in cedit. The general expo support will come later. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/cedit.c | 21 +++++++++++++++++++++ include/expo.h | 11 +++++++++++ 2 files changed, 32 insertions(+) diff --git a/boot/cedit.c b/boot/cedit.c index cc60e757649..ab1a79c1412 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -191,6 +191,27 @@ int cedit_do_action(struct expo *exp, struct scene *scn, scene_set_open(scn, act->select.id, false); cedit_arange(exp, vid_priv, scn->id); break; + case EXPOACT_POINT_OPEN: + scene_set_highlight_id(scn, act->select.id); + scene_set_open(scn, act->select.id, true); + cedit_arange(exp, vid_priv, scn->id); + break; + case EXPOACT_POINT_CLOSE: + /* Point to the item (select it in the menu) */ + ret = scene_menu_select_item(scn, scn->highlight_id, + act->select.id); + if (ret) + return log_msg_ret("pco", ret); + /* Close the menu */ + scene_set_open(scn, scn->highlight_id, false); + cedit_arange(exp, vid_priv, scn->id); + break; + case EXPOACT_REPOINT_OPEN: + scene_set_open(scn, act->select.prev_id, false); + scene_set_highlight_id(scn, act->select.id); + scene_set_open(scn, act->select.id, true); + cedit_arange(exp, vid_priv, scn->id); + break; case EXPOACT_SELECT: scene_set_open(scn, scn->highlight_id, false); cedit_arange(exp, vid_priv, scn->id); diff --git a/include/expo.h b/include/expo.h index 571ba513fa6..a860ba901e4 100644 --- a/include/expo.h +++ b/include/expo.h @@ -47,6 +47,12 @@ enum expo_id_t { * @EXPOACT_OPEN: menu was opened, so an item can be selected (@id indicates * which menu object) * @EXPOACT_CLOSE: menu was closed (@id indicates which menu object) + * @EXPOACT_POINT_OPEN: menu item was pointed to and menu opened (@id indicates + * which menu object) + * @EXPOACT_POINT_CLOSE: menu item was pointed to and menu closed @id indicates + * which menu item) + * @EXPOACT_REPOINT_OPEN: menu closed, another menu opened (@prev_id indicates + * the menu closed, @id indicates menu opened) * @EXPOACT_QUIT: request to exit the menu */ enum expoact_type { @@ -56,6 +62,9 @@ enum expoact_type { EXPOACT_SELECT, EXPOACT_OPEN, EXPOACT_CLOSE, + EXPOACT_POINT_OPEN, + EXPOACT_POINT_CLOSE, + EXPOACT_REPOINT_OPEN, EXPOACT_QUIT, }; @@ -65,6 +74,7 @@ enum expoact_type { * @type: Action type (EXPOACT_NONE if there is no action) * @select: Used for all actions except EXPOACT_NONE and EXPOACT_QUIT * @select.id: ID number of the object affected + * @select.prev_id: ID number of the old object that was highlighted * @select.changed: true if the selection has changed since last time (only * valid for EXPOACT_POINT_ITEM) */ @@ -73,6 +83,7 @@ struct expo_action { union { struct { int id; + int prev_id; bool changed; } select; }; -- 2.43.0