From patchwork Sun Jan 18 20:42:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1606 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=1768769066; bh=Tny2UdvtKruB5zqLd+9yYn2QC9H/1UC+sjmm3eSvdPI=; 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=MH+wpiwqU/B9Rys0rNVY/d99gCWuUabk9MWaXFBulXvDsg6nUDvKLTVMS+6N3EgeI 2zFNchvrHdQr6DxGJexn3o3vf3RhYII4JuEEaoWTTAuxTGsHtGx9lp3eSLiRpu8/qX mRKm5j3WAxt51wi8lID2u2Z3GoasaQAbNcpNxuJN70Au3y5JqnN70cXuraoU07/wwV biY57kXOZ9Physc+6Rfgte5+9mjI1G/p8sj2GuNNqH6DndLgobNuTEbkvl/x0D3AuJ Bef6eRaiTP9vnuKOekQRszBPJgSDAIcxTsFw3O0Lstm0GmgjjIMQz6PQAwOiC8VE7n o1J3SoS3fualA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C77D3694A8 for ; Sun, 18 Jan 2026 13:44:26 -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 ALfyQ9oLLP33 for ; Sun, 18 Jan 2026 13:44:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769066; bh=Tny2UdvtKruB5zqLd+9yYn2QC9H/1UC+sjmm3eSvdPI=; 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=MH+wpiwqU/B9Rys0rNVY/d99gCWuUabk9MWaXFBulXvDsg6nUDvKLTVMS+6N3EgeI 2zFNchvrHdQr6DxGJexn3o3vf3RhYII4JuEEaoWTTAuxTGsHtGx9lp3eSLiRpu8/qX mRKm5j3WAxt51wi8lID2u2Z3GoasaQAbNcpNxuJN70Au3y5JqnN70cXuraoU07/wwV biY57kXOZ9Physc+6Rfgte5+9mjI1G/p8sj2GuNNqH6DndLgobNuTEbkvl/x0D3AuJ Bef6eRaiTP9vnuKOekQRszBPJgSDAIcxTsFw3O0Lstm0GmgjjIMQz6PQAwOiC8VE7n o1J3SoS3fualA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AE60D69491 for ; Sun, 18 Jan 2026 13:44:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769065; bh=07fASjXWbHNb0UObRwGw5pnWLDRZZbWXa516xpPJE7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/WwETjvOYKbdcs0oP4vI5XnhcnzOtbw7HlnU14p7GjWMz4aF3kFrpp8nmlY0NKBj hO0XfeLjKAPALJl3BK6KnFKAl/96ENoGkRGkVQ47XgdoyL1nj5CoFnk9fKjAwOFP9Y VIGNNeVBgw8hnmvs3nGBARF0KBmzcdcCEfGytWledug0J3EhubUMGpTg8TAZC8gpJH tWK21CFpGqMZg6Bp8eSrdb9A12XPoo6a+WL9wu2znrZqIdGSGx1Uesus/JG01Gy8wY PfS7yhFoaCvVrHhFxIt+HaufHuywoskUKRIqJye1IhrztTWH4Aj1a2julL9NlNVuxR T4+ycI7AsqcBg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7C0BA69491; Sun, 18 Jan 2026 13:44:25 -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 WrTD0BzEbgPo; Sun, 18 Jan 2026 13:44:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769061; bh=5UUe56Zc6DP1gQwg9gFODwiWFHhfqiKp/gjzOtxzkTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QoD/98LebfluGsl9Zo1yl5BzTVVFfJYQyFWex5Q7MLOKxdm3zDBLIiO3QRGXe3qn1 2AqNjVKaLoTAqTBamBK3qhUQRoZteLizLLPJX0XW3ScMnhp6IlWaMifChpdEBLP/gN v0NNVIIJkLOyFKqBZElfW4xexY1AfqxXyE/z1TfoEkjJTAg+W38eYBIx4RgiwlOPnI FijT0UC0lWAZ45YXkL5D713LSNtCKOpnFSAAGdKYrVJuUtrOgzwYnl3FHtCjnvvtCc T59k2Huz7WX3eHeqwSUJluKp5+jPgU/3VpYhF66s6oP1oT6W4R4GpYbiBgiUeKgTCt tlUNSXWgF2+Jg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 30ABC6946A; Sun, 18 Jan 2026 13:44:21 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:54 -0700 Message-ID: <20260118204303.1982533-16-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: J3SLWGWXPMXLQSP53ZBLJHNK2M2VJGVP X-Message-ID-Hash: J3SLWGWXPMXLQSP53ZBLJHNK2M2VJGVP 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 15/16] expo: Add scene_txtin_arrange() for common arrangement code 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 Factor out common arrangement code from scene_textline_arrange() and scene_txted_arrange() into scene_txtin_arrange() This handles label positioning and setting the SCENEOF_POINT flag. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_internal.h | 14 ++++++++++++++ boot/scene_textedit.c | 26 ++++++-------------------- boot/scene_textline.c | 39 +++++++++++++-------------------------- boot/scene_txtin.c | 26 ++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 46 deletions(-) diff --git a/boot/scene_internal.h b/boot/scene_internal.h index b54bc1d426a..8c2196a7b11 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -521,6 +521,20 @@ void scene_menu_calc_bbox(struct scene_obj_menu *menu, */ int scene_txtin_init(struct scene_txtin *tin, uint size, uint line_chars); +/** + * scene_txtin_arrange() - Arrange common parts of a text-input object + * + * Sets the label position and SCENEOF_POINT flag + * + * @scn: Scene containing the object + * @arr: Arrangement info + * @obj: Object to arrange + * @tin: Text-input info + * Return: x position for edit object (positive), or -ve on error + */ +int scene_txtin_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj *obj, struct scene_txtin *tin); + /** * scene_txtin_calc_bbox() - Calculate bounding box for a text-input object * diff --git a/boot/scene_textedit.c b/boot/scene_textedit.c index 9d0bfb2d552..160b9457a50 100644 --- a/boot/scene_textedit.c +++ b/boot/scene_textedit.c @@ -79,35 +79,21 @@ int scene_txted_calc_dims(struct scene_obj_txtedit *ted, struct udevice *cons) 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 x; int ret; - x = ted->obj.req_bbox.x0; - y = ted->obj.req_bbox.y0; - if (ted->tin.label_id) { - ret = scene_obj_set_pos(scn, ted->tin.label_id, x, y); - if (ret < 0) - return log_msg_ret("tit", ret); - - x += arr->label_width + theme->textline_label_margin_x; - } + x = scene_txtin_arrange(scn, arr, &ted->obj, &ted->tin); + if (x < 0) + return log_msg_ret("arr", x); /* constrain the edit text to fit within the textedit bbox */ - ret = scene_obj_set_bbox(scn, ted->tin.edit_id, x, y, + ret = scene_obj_set_bbox(scn, ted->tin.edit_id, x, ted->obj.req_bbox.y0, 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->tin.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; + ted->obj.dims.y = 0; scene_obj_set_size(scn, ted->obj.id, ted->obj.dims.x, ted->obj.dims.y); return 0; diff --git a/boot/scene_textline.c b/boot/scene_textline.c index 960f5e8861f..f940be3ed28 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -71,37 +71,24 @@ int scene_textline_calc_dims(struct scene_obj_textline *tline, int scene_textline_arrange(struct scene *scn, struct expo_arrange_info *arr, struct scene_obj_textline *tline) { - const bool open = tline->obj.flags & SCENEOF_OPEN; - const struct expo_theme *theme = &scn->expo->theme; - bool point; + struct scene_obj *edit; int x, y; int ret; - x = tline->obj.req_bbox.x0; + x = scene_txtin_arrange(scn, arr, &tline->obj, &tline->tin); + if (x < 0) + return log_msg_ret("arr", x); + y = tline->obj.req_bbox.y0; - if (tline->tin.label_id) { - struct scene_obj *edit; - - ret = scene_obj_set_pos(scn, tline->tin.label_id, x, y); - if (ret < 0) - return log_msg_ret("tit", ret); - - x += arr->label_width + theme->textline_label_margin_x; - ret = scene_obj_set_pos(scn, tline->tin.edit_id, x, y); - if (ret < 0) - return log_msg_ret("til", ret); - - edit = scene_obj_find(scn, tline->tin.edit_id, SCENEOBJT_NONE); - if (!edit) - return log_msg_ret("tie", -ENOENT); - x += edit->dims.x; - y += edit->dims.y; - } + ret = scene_obj_set_pos(scn, tline->tin.edit_id, x, y); + if (ret < 0) + return log_msg_ret("pos", ret); - point = scn->highlight_id == tline->obj.id; - point &= !open; - scene_obj_flag_clrset(scn, tline->tin.edit_id, SCENEOF_POINT, - point ? SCENEOF_POINT : 0); + edit = scene_obj_find(scn, tline->tin.edit_id, SCENEOBJT_NONE); + if (!edit) + return log_msg_ret("fnd", -ENOENT); + x += edit->dims.x; + y += edit->dims.y; tline->obj.dims.x = x - tline->obj.req_bbox.x0; tline->obj.dims.y = y - tline->obj.req_bbox.y0; diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index cd27f9b7115..dbd2555f71d 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -27,6 +27,32 @@ int scene_txtin_init(struct scene_txtin *tin, uint size, uint line_chars) return 0; } +int scene_txtin_arrange(struct scene *scn, struct expo_arrange_info *arr, + struct scene_obj *obj, struct scene_txtin *tin) +{ + const bool open = obj->flags & SCENEOF_OPEN; + const struct expo_theme *theme = &scn->expo->theme; + bool point; + int x; + int ret; + + x = obj->req_bbox.x0; + if (tin->label_id) { + ret = scene_obj_set_pos(scn, tin->label_id, x, obj->req_bbox.y0); + if (ret < 0) + return log_msg_ret("lab", ret); + + x += arr->label_width + theme->textline_label_margin_x; + } + + point = scn->highlight_id == obj->id; + point &= !open; + scene_obj_flag_clrset(scn, tin->edit_id, SCENEOF_POINT, + point ? SCENEOF_POINT : 0); + + return x; +} + void scene_txtin_calc_bbox(struct scene_obj *obj, struct scene_txtin *tin, struct vidconsole_bbox *bbox, struct vidconsole_bbox *edit_bbox)