[PATCH v2 29/36] expo: Support opening a textline

Simon Glass sjg at chromium.org
Mon Oct 2 03:13:33 CEST 2023


This object needs special handling when it is opened, to set up the CLI
and the vidconsole context. Add special support for this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 boot/scene.c          | 32 ++++++++++++++++++++++++++++++++
 boot/scene_internal.h | 22 ++++++++++++++++++++++
 boot/scene_textline.c |  5 -----
 3 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/boot/scene.c b/boot/scene.c
index 0b44a13748ab..6c7c926f7c93 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -759,10 +759,42 @@ void scene_highlight_first(struct scene *scn)
 	}
 }
 
+static int scene_obj_open(struct scene *scn, struct scene_obj *obj)
+{
+	int ret;
+
+	switch (obj->type) {
+	case SCENEOBJT_NONE:
+	case SCENEOBJT_IMAGE:
+	case SCENEOBJT_MENU:
+	case SCENEOBJT_TEXT:
+		break;
+	case SCENEOBJT_TEXTLINE:
+		ret = scene_textline_open(scn,
+					  (struct scene_obj_textline *)obj);
+		if (ret)
+			return log_msg_ret("op", ret);
+		break;
+	}
+
+	return 0;
+}
+
 int scene_set_open(struct scene *scn, uint id, bool open)
 {
+	struct scene_obj *obj;
 	int ret;
 
+	obj = scene_obj_find(scn, id, SCENEOBJT_NONE);
+	if (!obj)
+		return log_msg_ret("find", -ENOENT);
+
+	if (open) {
+		ret = scene_obj_open(scn, obj);
+		if (ret)
+			return log_msg_ret("op", ret);
+	}
+
 	ret = scene_obj_flag_clrset(scn, id, SCENEOF_OPEN,
 				    open ? SCENEOF_OPEN : 0);
 	if (ret)
diff --git a/boot/scene_internal.h b/boot/scene_internal.h
index 1c2bfeadcd38..7a84977646a0 100644
--- a/boot/scene_internal.h
+++ b/boot/scene_internal.h
@@ -278,4 +278,26 @@ void scene_menu_calc_bbox(struct scene_obj_menu *menu,
 int scene_obj_calc_bbox(struct scene_obj *obj, struct vidconsole_bbox *bbox,
 			struct vidconsole_bbox *label_bbox);
 
+/**
+ * scene_textline_open() - Open a textline object
+ *
+ * Set up the text editor ready for use
+ *
+ * @scn: Scene containing the textline
+ * @tline: textline object
+ * Return: 0 if OK, -ve on error
+ */
+int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline);
+
+/**
+ * scene_textline_close() - Close a textline object
+ *
+ * Close out the text editor after use
+ *
+ * @scn: Scene containing the textline
+ * @tline: textline object
+ * Return: 0 if OK, -ve on error
+ */
+int scene_textline_close(struct scene *scn, struct scene_obj_textline *tline);
+
 #endif /* __SCENE_INTERNAL_H */
diff --git a/boot/scene_textline.c b/boot/scene_textline.c
index 2caa81ee1582..6ea072a1c268 100644
--- a/boot/scene_textline.c
+++ b/boot/scene_textline.c
@@ -227,8 +227,3 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline)
 
 	return 0;
 }
-
-int scene_textline_close(struct scene *scn, struct scene_obj_textline *tline)
-{
-	return 0;
-}
-- 
2.42.0.582.g8ccd20d70d-goog



More information about the U-Boot mailing list