From patchwork Sun Jan 18 20:42:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1601 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769043; bh=85i5VGul2I+TtFe08tFAF/0Bvi0+LD3A1r4rsXHqacs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=R8l6K5xLXWXEP6yeupZjlc0Gv4qA9zIABZAMqd/46sK/4J8JzJoE/wayYaiwxG8D+ /Fvj44OYFahXrj1RK1/wZEltM76Ulj3EnDvZAkpBXmNjGeFhbNDgKQ0vmPUumVxNC0 C++vyKXX6IpvcMWXjnnWJUq4ekY6SCZQb4z/EV76mUDN6eYu5QvXLDKHKU2J3fr8g/ diLkoUpx/Yc8AHUWRJh07z35LFpU/MPI5MEbzsQGVQZ5u8MGTUdETBBjpAjROv6FFL BhUG5wOz1/+MLDIgB43PSdczlcl7oKRwFaPKh8ZoBIV+leJMy4Wf+ttlFss7NSEJBe cDKT3GiorwvdQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9237F6949E for ; Sun, 18 Jan 2026 13:44:03 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id DxdQs6egz4yV for ; Sun, 18 Jan 2026 13:44:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769043; bh=85i5VGul2I+TtFe08tFAF/0Bvi0+LD3A1r4rsXHqacs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=R8l6K5xLXWXEP6yeupZjlc0Gv4qA9zIABZAMqd/46sK/4J8JzJoE/wayYaiwxG8D+ /Fvj44OYFahXrj1RK1/wZEltM76Ulj3EnDvZAkpBXmNjGeFhbNDgKQ0vmPUumVxNC0 C++vyKXX6IpvcMWXjnnWJUq4ekY6SCZQb4z/EV76mUDN6eYu5QvXLDKHKU2J3fr8g/ diLkoUpx/Yc8AHUWRJh07z35LFpU/MPI5MEbzsQGVQZ5u8MGTUdETBBjpAjROv6FFL BhUG5wOz1/+MLDIgB43PSdczlcl7oKRwFaPKh8ZoBIV+leJMy4Wf+ttlFss7NSEJBe cDKT3GiorwvdQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7BE0B69494 for ; Sun, 18 Jan 2026 13:44:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769042; bh=s0KSOZKAwlDZbe5Aqhl0v4RdFt9hh7ydGZDWs3C8ftI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFx2KIqeUZYFe2VNx2FNfb3U7JlHVFeC6eOu4/TMYlx7pP95F37ZMt3XK62k+R1rn bd3W2nledHe91padBiEllbQ4M7878IZln079xpP4ejJqyxnREpjUO7WaPq7QBWtPTl a8SHa8lQQgTTvzjvQKOKX2M1ceu+5P1zx0KgXilEt2qI6vOAoyH5A1sTbUETsbQjwn whooNGqhFoVzZ1waNHdNbg+fK+v+4L4GGdXcqfwqYrz0DOunMC6Tqfwbjs/1vkJPwe Lnmo7EqNSgppTgliHl3KVFLS3pdf49b2cs1ACKr8/K3R85Uw3QPQF3+6TRt+d+Zr9q GGSz+vI4p4fgw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7A6A06948C; Sun, 18 Jan 2026 13:44:02 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id VtR6GRUouaoP; Sun, 18 Jan 2026 13:44:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769038; bh=NH5XBrVNr+8bf2v4bJfzzGXofwEZ7Melf+klX3lPtU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6xaOHp4e1FduPMwrZJqPoHEEDwNZA/fCwu38VAka5Vzmm5gSdGs3sKXmYKs+QKz5 cKDt8XuPtDeEWDWHnX6eVjbv9k8LmIhiK6mgB0WMZHsRQ8K96mvK++YmiZ5gE2L8pE eYks7in9aUhx9tJQTU00yf7i+5PBl5owvjqG9bt+T8Oi8vvQoLrVNOfXTZC4AtLF0u YUUfTj/zJq7T8NetuUKvte9nRqYGL1x142pKlEDmlASODk3Ao9cAeYz+WvVGoFakAo k7SJO80k9gYnohrk5zJBMHyGeOqcmckZmSwuLIfyTSK5A0xVvJZ180hJoVfq0mnX+h Wi8fTZD2GU8lA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EACEF6946A; Sun, 18 Jan 2026 13:43:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:49 -0700 Message-ID: <20260118204303.1982533-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118204303.1982533-1-sjg@u-boot.org> References: <20260118204303.1982533-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YMG5MTRBCWMUTI4RQDTCC5YNIU5SPUST X-Message-ID-Hash: YMG5MTRBCWMUTI4RQDTCC5YNIU5SPUST X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/16] expo: Add arrangement support for textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add scene_txted_arrange() to position the label and edit text objects within a textedit, following the same pattern as textline: - Position the label at the textedit's position - Position edit text after the label (with margin) - Set the SCENEOF_POINT flag when highlighted but not open - Calculate the overall dimensions of the textedit Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 10 +++++++++- boot/scene_internal.h | 14 ++++++++++++++ boot/scene_textedit.c | 37 +++++++++++++++++++++++++++++++++++++ test/boot/expo.c | 2 +- 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index d515754c702..882a250e17d 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -868,7 +868,6 @@ int scene_arrange(struct scene *scn) case SCENEOBJT_IMAGE: case SCENEOBJT_TEXT: case SCENEOBJT_BOX: - case SCENEOBJT_TEXTEDIT: break; case SCENEOBJT_MENU: { struct scene_obj_menu *menu; @@ -888,6 +887,15 @@ int scene_arrange(struct scene *scn) return log_msg_ret("arr", ret); break; } + case SCENEOBJT_TEXTEDIT: { + struct scene_obj_txtedit *ted; + + ted = (struct scene_obj_txtedit *)obj, + ret = scene_txted_arrange(scn, &arr, ted); + if (ret) + return log_msg_ret("arr", ret); + break; + } } } ret = scene_sync_bbox(scn); diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 5cc81f031a0..1e5bd3d2a28 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -162,6 +162,20 @@ int scene_menu_arrange(struct scene *scn, struct expo_arrange_info *arr, int scene_textline_arrange(struct scene *scn, struct expo_arrange_info *arr, struct scene_obj_textline *tline); +/** + * scene_txted_arrange() - Set the position of things in a textedit + * + * This updates any items associated with a textedit to make sure they are + * positioned correctly relative to the textedit. + * + * @scn: Scene to update + * @arr: Arrangement information + * @ted: textedit to process + * Returns: 0 if OK, -ve on error + */ +int scene_txted_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_txtedit *ted); + /** * scene_apply_theme() - Apply a theme to a scene * diff --git a/boot/scene_textedit.c b/boot/scene_textedit.c index a55285f00cd..8714a4b5705 100644 --- a/boot/scene_textedit.c +++ b/boot/scene_textedit.c @@ -55,3 +55,40 @@ int scene_txted_set_font(struct scene *scn, uint id, const char *font_name, return scene_txt_set_font(scn, ted->edit_id, font_name, font_size); } + +int scene_txted_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj_txtedit *ted) +{ + const bool open = ted->obj.flags & SCENEOF_OPEN; + const struct expo_theme *theme = &scn->expo->theme; + bool point; + int x, y; + int ret; + + x = ted->obj.req_bbox.x0; + y = ted->obj.req_bbox.y0; + if (ted->label_id) { + ret = scene_obj_set_pos(scn, ted->label_id, x, y); + if (ret < 0) + return log_msg_ret("tit", ret); + + x += arr->label_width + theme->textline_label_margin_x; + } + + /* constrain the edit text to fit within the textedit bbox */ + ret = scene_obj_set_bbox(scn, ted->edit_id, x, y, + ted->obj.req_bbox.x1, ted->obj.req_bbox.y1); + if (ret < 0) + return log_msg_ret("edi", ret); + + point = scn->highlight_id == ted->obj.id; + point &= !open; + scene_obj_flag_clrset(scn, ted->edit_id, SCENEOF_POINT, + point ? SCENEOF_POINT : 0); + + ted->obj.dims.x = x - ted->obj.req_bbox.x0; + ted->obj.dims.y = y - ted->obj.req_bbox.y0; + scene_obj_set_size(scn, ted->obj.id, ted->obj.dims.x, ted->obj.dims.y); + + return 0; +} diff --git a/test/boot/expo.c b/test/boot/expo.c index dc9ebe702b8..b6ee4892d7a 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1533,7 +1533,7 @@ static int expo_render_textedit(struct unit_test_state *uts) expo_set_scene_id(exp, SCENE1); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(19651, video_compress_fb(uts, dev, false)); + ut_asserteq(19493, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy);