expo: Adjust how menu items are highlighted
At present when the user moves to a new menu item, the menu code handles this immediately. This means it is not possible to use an expo action to effect the same change. Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action(). Expand the test to cover this. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -180,6 +180,7 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
|
|||||||
{
|
{
|
||||||
struct bootflow *sel_bflow;
|
struct bootflow *sel_bflow;
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
|
struct scene *scn;
|
||||||
struct expo *exp;
|
struct expo *exp;
|
||||||
uint sel_id;
|
uint sel_id;
|
||||||
bool done;
|
bool done;
|
||||||
@@ -209,6 +210,9 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
|
|||||||
ret = expo_set_scene_id(exp, MAIN);
|
ret = expo_set_scene_id(exp, MAIN);
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("scn", ret);
|
return log_msg_ret("scn", ret);
|
||||||
|
scn = expo_lookup_scene_id(exp, MAIN);
|
||||||
|
if (!scn)
|
||||||
|
return log_msg_ret("scn", -ENOENT);
|
||||||
|
|
||||||
if (text_mode)
|
if (text_mode)
|
||||||
expo_set_text_mode(exp, text_mode);
|
expo_set_text_mode(exp, text_mode);
|
||||||
@@ -224,6 +228,12 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
|
|||||||
sel_id = act.select.id;
|
sel_id = act.select.id;
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
case EXPOACT_POINT_ITEM:
|
||||||
|
ret = scene_menu_select_item(scn,
|
||||||
|
OBJ_MENU, act.select.id);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("bmp", ret);
|
||||||
|
break;
|
||||||
case EXPOACT_QUIT:
|
case EXPOACT_QUIT:
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -148,10 +148,17 @@ int cedit_prepare(struct expo *exp, struct udevice *vid_dev,
|
|||||||
int cedit_do_action(struct expo *exp, struct scene *scn,
|
int cedit_do_action(struct expo *exp, struct scene *scn,
|
||||||
struct video_priv *vid_priv, struct expo_action *act)
|
struct video_priv *vid_priv, struct expo_action *act)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
switch (act->type) {
|
switch (act->type) {
|
||||||
case EXPOACT_NONE:
|
case EXPOACT_NONE:
|
||||||
case EXPOACT_POINT_ITEM:
|
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
case EXPOACT_POINT_ITEM:
|
||||||
|
ret = scene_menu_select_item(scn, scn->highlight_id,
|
||||||
|
act->select.id);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("cdp", ret);
|
||||||
|
break;
|
||||||
case EXPOACT_POINT_OBJ:
|
case EXPOACT_POINT_OBJ:
|
||||||
scene_set_highlight_id(scn, act->select.id);
|
scene_set_highlight_id(scn, act->select.id);
|
||||||
cedit_arange(exp, vid_priv, scn->id);
|
cedit_arange(exp, vid_priv, scn->id);
|
||||||
|
|||||||
@@ -406,8 +406,6 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_point_to_item(menu, item->id);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -588,6 +588,8 @@ static int expo_render_image(struct unit_test_state *uts)
|
|||||||
expo_set_scene_id(exp, SCENE1);
|
expo_set_scene_id(exp, SCENE1);
|
||||||
ut_assertok(expo_render(exp));
|
ut_assertok(expo_render(exp));
|
||||||
|
|
||||||
|
ut_asserteq(0, scn->highlight_id);
|
||||||
|
ut_assertok(scene_arrange(scn));
|
||||||
ut_asserteq(0, scn->highlight_id);
|
ut_asserteq(0, scn->highlight_id);
|
||||||
|
|
||||||
/* move down */
|
/* move down */
|
||||||
@@ -599,6 +601,7 @@ static int expo_render_image(struct unit_test_state *uts)
|
|||||||
ut_asserteq(ITEM2, act.select.id);
|
ut_asserteq(ITEM2, act.select.id);
|
||||||
ut_assertok(scene_menu_select_item(scn, OBJ_MENU, act.select.id));
|
ut_assertok(scene_menu_select_item(scn, OBJ_MENU, act.select.id));
|
||||||
ut_asserteq(ITEM2, scene_menu_get_cur_item(scn, OBJ_MENU));
|
ut_asserteq(ITEM2, scene_menu_get_cur_item(scn, OBJ_MENU));
|
||||||
|
ut_assertok(scene_arrange(scn));
|
||||||
ut_assertok(expo_render(exp));
|
ut_assertok(expo_render(exp));
|
||||||
|
|
||||||
/* make sure only the preview for the second item is shown */
|
/* make sure only the preview for the second item is shown */
|
||||||
@@ -639,6 +642,7 @@ static int expo_render_image(struct unit_test_state *uts)
|
|||||||
|
|
||||||
ut_asserteq(EXPOACT_POINT_ITEM, act.type);
|
ut_asserteq(EXPOACT_POINT_ITEM, act.type);
|
||||||
ut_asserteq(ITEM1, act.select.id);
|
ut_asserteq(ITEM1, act.select.id);
|
||||||
|
ut_assertok(scene_menu_select_item(scn, OBJ_MENU, act.select.id));
|
||||||
|
|
||||||
ut_assertok(expo_render(exp));
|
ut_assertok(expo_render(exp));
|
||||||
ut_assert_nextline("U-Boot : Boot Menu");
|
ut_assert_nextline("U-Boot : Boot Menu");
|
||||||
|
|||||||
Reference in New Issue
Block a user