summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 19:22:50 +0300
committerTom Rini <trini@konsulko.com>2023-07-14 19:54:51 +0300
commitce72c9ec260d18cc127c275daf3ec1d18c230e2a (patch)
treefff5af8ebc7999e26e59f484a68754d6977cc6b3 /boot
parentae45d6cf5a564851a9b9d58e05425e4cf1dfe8aa (diff)
downloadu-boot-ce72c9ec260d18cc127c275daf3ec1d18c230e2a.tar.xz
expo: Use flags for objects
We currently have just a 'hide' property for each object. In preparation for adding more properties, convert the struct to use a flags value, instead of individual booleans. This is more extensible. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/scene.c17
-rw-r--r--boot/scene_internal.h11
2 files changed, 26 insertions, 2 deletions
diff --git a/boot/scene.c b/boot/scene.c
index 8033d77fb2..dd1472d4f9 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -209,12 +209,25 @@ int scene_obj_set_pos(struct scene *scn, uint id, int x, int y)
int scene_obj_set_hide(struct scene *scn, uint id, bool hide)
{
+ int ret;
+
+ ret = scene_obj_flag_clrset(scn, id, SCENEOF_HIDE,
+ hide ? SCENEOF_HIDE : 0);
+ if (ret)
+ return log_msg_ret("flg", ret);
+
+ return 0;
+}
+
+int scene_obj_flag_clrset(struct scene *scn, uint id, uint clr, uint set)
+{
struct scene_obj *obj;
obj = scene_obj_find(scn, id, SCENEOBJT_NONE);
if (!obj)
return log_msg_ret("find", -ENOENT);
- obj->hide = hide;
+ obj->flags &= ~clr;
+ obj->flags |= set;
return 0;
}
@@ -358,7 +371,7 @@ int scene_render(struct scene *scn)
int ret;
list_for_each_entry(obj, &scn->obj_head, sibling) {
- if (!obj->hide) {
+ if (!(obj->flags & SCENEOF_HIDE)) {
ret = scene_obj_render(obj, exp->text_mode);
if (ret && ret != -ENOTSUPP)
return log_msg_ret("ren", ret);
diff --git a/boot/scene_internal.h b/boot/scene_internal.h
index 9f173dd749..24a2ba6a6a 100644
--- a/boot/scene_internal.h
+++ b/boot/scene_internal.h
@@ -55,6 +55,17 @@ int scene_obj_add(struct scene *scn, const char *name, uint id,
enum scene_obj_t type, uint size, struct scene_obj **objp);
/**
+ * scene_obj_flag_clrset() - Adjust object flags
+ *
+ * @scn: Scene to update
+ * @id: ID of object to update
+ * @clr: Bits to clear in the object's flags
+ * @set: Bits to set in the object's flags
+ * Returns 0 if OK, -ENOENT if the object was not found
+ */
+int scene_obj_flag_clrset(struct scene *scn, uint id, uint clr, uint set);
+
+/**
* scene_menu_arrange() - Set the position of things in the menu
*
* This updates any items associated with a menu to make sure they are