mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-10-10 23:21:47 +02:00
expo: Avoid automatically arranging the scene
This should ideally be done once after all scene changes have been made. Require an explicit call when everything is ready. Always arrange after a key it sent, just for convenience. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
42b18494bd
commit
14a86a5107
@ -124,6 +124,10 @@ int bootflow_menu_new(struct expo **expp)
|
|||||||
priv->num_bootflows++;
|
priv->num_bootflows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = scene_arrange(scn);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("arr", ret);
|
||||||
|
|
||||||
*expp = exp;
|
*expp = exp;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
15
boot/expo.c
15
boot/expo.c
@ -116,8 +116,16 @@ struct scene *expo_lookup_scene_id(struct expo *exp, uint scene_id)
|
|||||||
|
|
||||||
int expo_set_scene_id(struct expo *exp, uint scene_id)
|
int expo_set_scene_id(struct expo *exp, uint scene_id)
|
||||||
{
|
{
|
||||||
if (!expo_lookup_scene_id(exp, scene_id))
|
struct scene *scn;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
scn = expo_lookup_scene_id(exp, scene_id);
|
||||||
|
if (!scn)
|
||||||
return log_msg_ret("id", -ENOENT);
|
return log_msg_ret("id", -ENOENT);
|
||||||
|
ret = scene_arrange(scn);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("arr", ret);
|
||||||
|
|
||||||
exp->scene_id = scene_id;
|
exp->scene_id = scene_id;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -165,6 +173,11 @@ int expo_send_key(struct expo *exp, int key)
|
|||||||
ret = scene_send_key(scn, key, &exp->action);
|
ret = scene_send_key(scn, key, &exp->action);
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("key", ret);
|
return log_msg_ret("key", ret);
|
||||||
|
|
||||||
|
/* arrange it to get any changes */
|
||||||
|
ret = scene_arrange(scn);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("arr", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return scn ? 0 : -ECHILD;
|
return scn ? 0 : -ECHILD;
|
||||||
|
@ -211,8 +211,6 @@ int scene_obj_set_pos(struct scene *scn, uint id, int x, int y)
|
|||||||
return log_msg_ret("find", -ENOENT);
|
return log_msg_ret("find", -ENOENT);
|
||||||
obj->x = x;
|
obj->x = x;
|
||||||
obj->y = y;
|
obj->y = y;
|
||||||
if (obj->type == SCENEOBJT_MENU)
|
|
||||||
scene_menu_arrange(scn, (struct scene_obj_menu *)obj);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -391,11 +389,6 @@ int scene_send_key(struct scene *scn, int key, struct expo_action *event)
|
|||||||
ret = scene_menu_send_key(scn, menu, key, event);
|
ret = scene_menu_send_key(scn, menu, key, event);
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("key", ret);
|
return log_msg_ret("key", ret);
|
||||||
|
|
||||||
/* only allow one menu */
|
|
||||||
ret = scene_menu_arrange(scn, menu);
|
|
||||||
if (ret)
|
|
||||||
return log_msg_ret("arr", ret);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,10 +158,6 @@ int scene_menu(struct scene *scn, const char *name, uint id,
|
|||||||
*menup = menu;
|
*menup = menu;
|
||||||
INIT_LIST_HEAD(&menu->item_head);
|
INIT_LIST_HEAD(&menu->item_head);
|
||||||
|
|
||||||
ret = scene_menu_arrange(scn, menu);
|
|
||||||
if (ret)
|
|
||||||
return log_msg_ret("pos", ret);
|
|
||||||
|
|
||||||
return menu->obj.id;
|
return menu->obj.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +254,6 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id,
|
|||||||
{
|
{
|
||||||
struct scene_obj_menu *menu;
|
struct scene_obj_menu *menu;
|
||||||
struct scene_menitem *item;
|
struct scene_menitem *item;
|
||||||
int ret;
|
|
||||||
|
|
||||||
menu = scene_obj_find(scn, menu_id, SCENEOBJT_MENU);
|
menu = scene_obj_find(scn, menu_id, SCENEOBJT_MENU);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
@ -285,10 +280,6 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id,
|
|||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
list_add_tail(&item->sibling, &menu->item_head);
|
list_add_tail(&item->sibling, &menu->item_head);
|
||||||
|
|
||||||
ret = scene_menu_arrange(scn, menu);
|
|
||||||
if (ret)
|
|
||||||
return log_msg_ret("pos", ret);
|
|
||||||
|
|
||||||
if (itemp)
|
if (itemp)
|
||||||
*itemp = item;
|
*itemp = item;
|
||||||
|
|
||||||
|
@ -348,7 +348,9 @@ static int expo_object_menu(struct unit_test_state *uts)
|
|||||||
ut_asserteq(desc_id, item->desc_id);
|
ut_asserteq(desc_id, item->desc_id);
|
||||||
ut_asserteq(preview_id, item->preview_id);
|
ut_asserteq(preview_id, item->preview_id);
|
||||||
|
|
||||||
/* adding an item should cause the first item to become current */
|
ut_assertok(scene_arrange(scn));
|
||||||
|
|
||||||
|
/* arranging the scene should cause the first item to become current */
|
||||||
ut_asserteq(id, menu->cur_item_id);
|
ut_asserteq(id, menu->cur_item_id);
|
||||||
|
|
||||||
/* the title should be at the top */
|
/* the title should be at the top */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user