From patchwork Sun Jan 18 20:42:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1604 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=1768769058; bh=D9Ft2spy6wXaAjIvCNK64+1MUkzx8/WFpGBxxld4lRU=; 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=OE2vDvjSBhMxuR8bblqAOs0YHUXyQ68PkiefSRPZtW+164Aq0amcUjQUwoXW8IEPQ iBtkVar0NTAcviFxOtG7OlLjPR5luuMdDXET8PU+6694qRKnNY3QnQaBAiqHQQUQsj e/cEdSbm9kRqszuq+EG50manl9+JMEIxOxT8H44KtTAvu8faB8zMf97rFtCoIzkrV+ uAK8nvnBmgkUVd6OBD5NUYBwoXIAgN33/qgIT35ImbV0BFxx+UO3ieR/YjtiHj3vhG OR+dLwM6Hl+AXe8CSxQFEOjZ5Ddyx+y9j5L6aqi63waoiwq/K5dFtmymi0aiXHERAU KHjzCZkHJXlsA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 780366949D for ; Sun, 18 Jan 2026 13:44:18 -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 vghoURcr3lzz for ; Sun, 18 Jan 2026 13:44:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769058; bh=D9Ft2spy6wXaAjIvCNK64+1MUkzx8/WFpGBxxld4lRU=; 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=OE2vDvjSBhMxuR8bblqAOs0YHUXyQ68PkiefSRPZtW+164Aq0amcUjQUwoXW8IEPQ iBtkVar0NTAcviFxOtG7OlLjPR5luuMdDXET8PU+6694qRKnNY3QnQaBAiqHQQUQsj e/cEdSbm9kRqszuq+EG50manl9+JMEIxOxT8H44KtTAvu8faB8zMf97rFtCoIzkrV+ uAK8nvnBmgkUVd6OBD5NUYBwoXIAgN33/qgIT35ImbV0BFxx+UO3ieR/YjtiHj3vhG OR+dLwM6Hl+AXe8CSxQFEOjZ5Ddyx+y9j5L6aqi63waoiwq/K5dFtmymi0aiXHERAU KHjzCZkHJXlsA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 60BBC69491 for ; Sun, 18 Jan 2026 13:44:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769056; bh=ag7LzEncJZkCj3KI4Ypt5wIORErsqjGb6QTYm7qFINI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iu6WT4oNkaE9JL9K4D3xXt6yyA30pwU79ztnffVyjadfAH5pUOgsqC4QQqBjKQpUr CDS9Cr+89GiLhdmjN0eVePdRYQRfVLQ8jHIst74kekFYQm89cxlOTWYMpw3BHCPNSe 6PYRPhLm95og5h5WPVmLezAf/0lt5TV5Ptu6QLkFvBQPh4p+blFpxkt2LaYq9xhwau /Dda1oX1u1/umhJUkhFNog6sRWivjbxJuYf8/8lCG8TEjzSmGDySeliAHY0PQDJfly t72ROjOARddyydR0lOs3bUecKOSdP0ge8wwxenDM2l+NIeVtM/zgDc/rQLaI/SkW0s tjfRRYWLBYRLg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4C3E96948C; Sun, 18 Jan 2026 13:44:16 -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 7f3I64Spum_X; Sun, 18 Jan 2026 13:44:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769052; bh=cd+C/eHgeeolqTOdNKje/h6cLqWLYmYXAUMA9TDcZFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyqFEIdJFvo1G55wQ4b0LcHO1yQAe94MiCxNt7Dlu9VzJl9TDoW7VbhQjB0aIMyb2 AHIBFWprIi3zgjSjhfaiszxWuruQdzW7SXa3ZRa3CRqsvDCunrnEoTIJRXtxIG5Sox YN3nafW4SVWI/SeFYLzOxK3PpldzPEP+IgrchAYt8DhZw3LrEfYm5vybXRpoQK8Zbz 6ZCsBY9Bi37X97oVK7hBFc4KXdOOTHgseS5tYTWH+jnSdEuBJsVBXunI/FZYOsMuXb HhPZulxZyo271Wxvs5A94LAKHf5O0XA6L4PyhneeOz91VNtq1EA5jQtY6VZNpQI4Z0 yPQj66xNj8fQg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 05F346946A; Sun, 18 Jan 2026 13:44:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:52 -0700 Message-ID: <20260118204303.1982533-14-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: EOXVU5VSRR5Q7RYN2EWQ6VKPNW764K4W X-Message-ID-Hash: EOXVU5VSRR5Q7RYN2EWQ6VKPNW764K4W 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 13/16] expo: Add scene_obj_txtin() helper for text-input objects 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 a static inline helper to get the scene_txtin pointer from a scene object. This simplifies code that handles both textline and textedit objects, since both have scene_txtin at the same offset. Use this in scene_obj_calc_bbox() to combine the TEXTLINE and TEXTEDIT cases. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 19 ++++--------------- boot/scene_internal.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 220fbf26b44..5691cbce847 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -1447,23 +1447,12 @@ int scene_obj_calc_bbox(struct scene_obj *obj, struct vidconsole_bbox bbox[]) scene_menu_calc_bbox(menu, bbox); break; } - case SCENEOBJT_TEXTLINE: { - struct scene_obj_textline *tline; - - tline = (struct scene_obj_textline *)obj; - 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]); + case SCENEOBJT_TEXTLINE: + case SCENEOBJT_TEXTEDIT: + scene_txtin_calc_bbox(obj, scene_obj_txtin(obj), + &bbox[SCENEBB_all], &bbox[SCENEBB_label]); break; } - } return 0; } diff --git a/boot/scene_internal.h b/boot/scene_internal.h index a3eb720c385..cc58a2264f6 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -29,6 +29,20 @@ enum scene_obj_t; typedef int (*expo_scene_obj_iterator)(struct scene_obj *obj, void *priv); +/** + * scene_obj_txtin() - Get text-input info from a scene object + * + * This works for both textline and textedit objects since they have + * struct scene_txtin at the same offset (immediately after struct scene_obj). + * + * @obj: Object to get text-input info from + * Return: pointer to the text-input info + */ +static inline struct scene_txtin *scene_obj_txtin(struct scene_obj *obj) +{ + return (struct scene_txtin *)(obj + 1); +} + /** * enum scene_bbox_t - Parts of an object which can have a bounding box *