@@ -61,7 +61,7 @@ obj-$(CONFIG_$(PHASE_)LOAD_FIT) += common_fit.o
obj-$(CONFIG_$(PHASE_)EXPO) += expo.o scene.o expo_build.o
obj-$(CONFIG_$(PHASE_)EXPO_DUMP) += expo_dump.o
-obj-$(CONFIG_$(PHASE_)EXPO) += scene_menu.o scene_textline.o scene_textedit.o
+obj-$(CONFIG_$(PHASE_)EXPO) += scene_menu.o scene_textline.o scene_textedit.o scene_txtin.o
obj-$(CONFIG_$(PHASE_)EXPO_TEST) += expo_test.o
ifdef CONFIG_COREBOOT_SYSINFO
obj-$(CONFIG_$(PHASE_)EXPO) += expo_build_cb.o
@@ -1440,7 +1440,6 @@ int scene_obj_calc_bbox(struct scene_obj *obj, struct vidconsole_bbox bbox[])
case SCENEOBJT_IMAGE:
case SCENEOBJT_TEXT:
case SCENEOBJT_BOX:
- case SCENEOBJT_TEXTEDIT:
return -ENOSYS;
case SCENEOBJT_MENU: {
struct scene_obj_menu *menu = (struct scene_obj_menu *)obj;
@@ -1452,8 +1451,16 @@ int scene_obj_calc_bbox(struct scene_obj *obj, struct vidconsole_bbox bbox[])
struct scene_obj_textline *tline;
tline = (struct scene_obj_textline *)obj;
- scene_textline_calc_bbox(tline, &bbox[SCENEBB_all],
- &bbox[SCENEBB_label]);
+ scene_txtin_calc_bbox(obj, &tline->tin, &bbox[SCENEBB_all],
+ &bbox[SCENEBB_label]);
+ break;
+ }
+ case SCENEOBJT_TEXTEDIT: {
+ struct scene_obj_txtedit *ted;
+
+ ted = (struct scene_obj_txtedit *)obj;
+ scene_txtin_calc_bbox(obj, &ted->tin, &bbox[SCENEBB_all],
+ &bbox[SCENEBB_label]);
break;
}
}
@@ -20,6 +20,7 @@ struct scene_obj_dims;
struct scene_obj_menu;
struct scene_obj_textline;
struct scene_obj_txtedit;
+struct scene_txtin;
struct scene_txt_generic;
struct udevice;
struct vidconsole_bbox;
@@ -497,16 +498,16 @@ void scene_menu_calc_bbox(struct scene_obj_menu *menu,
struct vidconsole_bbox *bbox);
/**
- * scene_textline_calc_bbox() - Calculate bounding box for the textline
+ * scene_txtin_calc_bbox() - Calculate bounding box for a text-input object
*
- * @textline: Menu to process
- * @bbox: Returns bounding box of textline including prompt
+ * @obj: Object to process
+ * @tin: Text-input object info
+ * @bbox: Returns bounding box of object including label
* @edit_bbox: Returns bounding box of editable part
- * Return: 0 if OK, -ve on error
*/
-void scene_textline_calc_bbox(struct scene_obj_textline *menu,
- struct vidconsole_bbox *bbox,
- struct vidconsole_bbox *label_bbox);
+void scene_txtin_calc_bbox(struct scene_obj *obj, struct scene_txtin *tin,
+ struct vidconsole_bbox *bbox,
+ struct vidconsole_bbox *edit_bbox);
/**
* scene_obj_calc_bbox() - Calculate bounding boxes for an object
@@ -56,6 +56,30 @@ int scene_txted_set_font(struct scene *scn, uint id, const char *font_name,
return scene_txt_set_font(scn, ted->tin.edit_id, font_name, font_size);
}
+int scene_txted_calc_dims(struct scene_obj_txtedit *ted, struct udevice *cons)
+{
+ struct scene *scn = ted->obj.scene;
+ struct scene_obj_txt *txt;
+ int ret;
+
+ txt = scene_obj_find(scn, ted->tin.edit_id, SCENEOBJT_NONE);
+ if (!txt)
+ return log_msg_ret("txt", -ENOENT);
+
+ /*
+ * Set the edit text's bbox to match the textedit's bbox. This ensures
+ * SCENEOF_SIZE_VALID is set so vidconsole_measure() applies the width
+ * limit for word-wrapping/clipping.
+ */
+ ret = scene_obj_set_bbox(scn, ted->tin.edit_id,
+ ted->obj.req_bbox.x0, ted->obj.req_bbox.y0,
+ ted->obj.req_bbox.x1, ted->obj.req_bbox.y1);
+ if (ret < 0)
+ return log_msg_ret("sbb", ret);
+
+ return 0;
+}
+
int scene_txted_arrange(struct scene *scn, struct expo_arrange_info *arr,
struct scene_obj_txtedit *ted)
{
@@ -44,22 +44,6 @@ int scene_textline(struct scene *scn, const char *name, uint id,
return tline->obj.id;
}
-void scene_textline_calc_bbox(struct scene_obj_textline *tline,
- struct vidconsole_bbox *bbox,
- struct vidconsole_bbox *edit_bbox)
-{
- const struct expo_theme *theme = &tline->obj.scene->expo->theme;
- int inset = theme->menu_inset;
-
- bbox->valid = false;
- scene_bbox_union(tline->obj.scene, tline->tin.label_id, inset, bbox);
- scene_bbox_union(tline->obj.scene, tline->tin.edit_id, inset, bbox);
-
- edit_bbox->valid = false;
- scene_bbox_union(tline->obj.scene, tline->tin.edit_id, inset,
- edit_bbox);
-}
-
int scene_textline_calc_dims(struct scene_obj_textline *tline,
struct udevice *cons)
{
new file mode 100644
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Common code for text-input scene objects (textline, textedit)
+ *
+ * Copyright 2026 Canonical Ltd
+ * Written by Simon Glass <simon.glass@canonical.com>
+ */
+
+#define LOG_CATEGORY LOGC_EXPO
+
+#include <expo.h>
+#include <log.h>
+#include <video_console.h>
+#include "scene_internal.h"
+
+void scene_txtin_calc_bbox(struct scene_obj *obj, struct scene_txtin *tin,
+ struct vidconsole_bbox *bbox,
+ struct vidconsole_bbox *edit_bbox)
+{
+ struct scene *scn = obj->scene;
+ const struct expo_theme *theme = &scn->expo->theme;
+ int inset = theme->menu_inset;
+
+ bbox->valid = false;
+ scene_bbox_union(scn, tin->label_id, inset, bbox);
+ scene_bbox_union(scn, tin->edit_id, inset, bbox);
+
+ edit_bbox->valid = false;
+ scene_bbox_union(scn, tin->edit_id, inset, edit_bbox);
+}