From patchwork Thu Sep 25 17:47:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 429 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=1758822554; bh=2M0K6i0gEEY8ZjxfEjAawp0+qhc3fEicmt7nHs8V5e4=; 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=CinU3Y8HEkB6GCD4OE4ApOG9hPMse+/AG7INc9VcKKRt/KaJ+2Kebzdc/UWf8yawi gHmdHCJZEVUY1sYIelQqDPlW+5zJdUQreMbv5oSEc7UPcztWhTKmNHi2oZHfgEunmZ +wWjQ58AItMtrqFiHCiAXuyU98vLsv3Ihal23O09qTeeIVmzTlKEasWSqZw08+HdDh +739FycIWliDSFoc3KPY/lcmyoq6zZ7eQPHOYc3Fk6B19KIwYZAqrC/iJLPSShWpDw KghY7agUXl5IT6ePWD3G4hi3p+VdHeVdVZEHG8dzQCv9VySXdfMgfrFiZBhbgWCrzx f2wvTID6ZESRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 536E167D9A for ; Thu, 25 Sep 2025 11:49:14 -0600 (MDT) 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 Rr8F_Uejcwpx for ; Thu, 25 Sep 2025 11:49:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758822554; bh=2M0K6i0gEEY8ZjxfEjAawp0+qhc3fEicmt7nHs8V5e4=; 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=CinU3Y8HEkB6GCD4OE4ApOG9hPMse+/AG7INc9VcKKRt/KaJ+2Kebzdc/UWf8yawi gHmdHCJZEVUY1sYIelQqDPlW+5zJdUQreMbv5oSEc7UPcztWhTKmNHi2oZHfgEunmZ +wWjQ58AItMtrqFiHCiAXuyU98vLsv3Ihal23O09qTeeIVmzTlKEasWSqZw08+HdDh +739FycIWliDSFoc3KPY/lcmyoq6zZ7eQPHOYc3Fk6B19KIwYZAqrC/iJLPSShWpDw KghY7agUXl5IT6ePWD3G4hi3p+VdHeVdVZEHG8dzQCv9VySXdfMgfrFiZBhbgWCrzx f2wvTID6ZESRg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 42AAD67D90 for ; Thu, 25 Sep 2025 11:49:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758822552; bh=Gxn28uiFtj/jfMn/CVSeyylCpJtaNtLTa/9fIxyG7/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CFcThBS5WD/fh4E31EO4mps8jWWrelpw4umN2vgZ/QakidramXxgDaHYAigLflwh6 BkImQU5dxATBp7OMe+8hyoK/A9VkVPxn4bgVVwSqGMRP66WG5237IfVdiw2d9Jrdu3 nsPRXF74Yx6h9rlpkIUD6ir7/EO2luBY7dioLmgqgQJkuC6H9BvG5UW21w3fg3jWNm QEdXOKTGmC4arGWr/pw5YaH+L00g8A7NxaIZvc669/Y5FgVzqOpx4dGpn1aswbzqQz SXSNZC/DmbIFoSfCwFrb/gPz6wR1RZWUAPAgXmjrU3/k0yDD/8s/A0JckFdjfGlv/O SaybD580LgOVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2F95F67D93; Thu, 25 Sep 2025 11:49:12 -0600 (MDT) 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 0vkavXCkKhpC; Thu, 25 Sep 2025 11:49:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758822547; bh=Eze9vPjTdSeji2h7gPU/bUBaaPtotoB4bUguyHumYmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFkkVoWwxSDTFDxCyFVqNS98VBELJ+2NfIjO4E0+ELRU322p5955QQCXsAHaVBOiP 1+HrMflvlVuEXiOcIIR79j4AIgK3+CfsRZGIJB04oWekzZFtWebpv3+/PazH3/On5C 3aVnNUWNykDnOFOJvybLb5qgS//dfvwotPcBPju2O3OPn2k2Z1XW1rIDJJo+0DqKQp GbB0LZFAJdEx7HxVRaVXSpUp6PX+dbCXxFHS/Pg4efDdb8AIeJppEEcgHh6Wsimi8B B2L1XLmL3FdNL5Y+DyPBI031SYh2R6GC4dhAd0nyBpsfZs3l5yiwyfWocfirlVR+eN FP0CW+7ZXTVXg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D796C67CEF; Thu, 25 Sep 2025 11:49:06 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 25 Sep 2025 11:47:41 -0600 Message-ID: <20250925174753.3429102-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250925174753.3429102-1-sjg@u-boot.org> References: <20250925174753.3429102-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5CJFWRCAIL33XQURSBSGC6C5SL3K57DE X-Message-ID-Hash: 5CJFWRCAIL33XQURSBSGC6C5SL3K57DE 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: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 17/22] expo: Allow manual positioning of menu items 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 Sometimes we want to position items individually rather than relying on the automatic scene layout. Provide a flag for this, expanding the type to cope. Also add an assertion that the flags fit in the available space. Signed-off-by: Simon Glass --- boot/scene.c | 14 ++++++++++++++ include/expo.h | 27 +++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index d7e0d008b56..96130f160fc 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -359,6 +359,18 @@ int scene_obj_set_hide(struct scene *scn, uint id, bool hide) return 0; } +int scene_obj_set_manual(struct scene *scn, uint id, bool manual) +{ + int ret; + + ret = scene_obj_flag_clrset(scn, id, SCENEOF_MANUAL, + manual ? SCENEOF_MANUAL : 0); + if (ret) + return log_msg_ret("fla", ret); + + return 0; +} + int scene_obj_flag_clrset(struct scene *scn, uint id, uint clr, uint set) { struct scene_obj *obj; @@ -810,6 +822,8 @@ int scene_arrange(struct scene *scn) handle_alignment(obj->horiz, obj->vert, &obj->bbox, &obj->dims, xsize, ysize, &obj->ofs); + if (obj->flags & SCENEOF_MANUAL) + continue; switch (obj->type) { case SCENEOBJT_NONE: case SCENEOBJT_IMAGE: diff --git a/include/expo.h b/include/expo.h index d6983ee77d4..e359da1343b 100644 --- a/include/expo.h +++ b/include/expo.h @@ -313,6 +313,8 @@ enum scene_obj_align { * @SCENEOF_SYNC_SIZE: object's size (width/height) has changed * @SCENEOF_SYNC_WIDTH: object's widget has changed * @SCENEOF_SYNC_BBOX: object's bounding box has changed + * @SCENEOF_MANUAL: manually arrange the items associated with this object + * @SCENEOF_LAST: used just as a check for the size of the flags mask */ enum scene_obj_flags_t { SCENEOF_HIDE = 1 << 0, @@ -323,6 +325,9 @@ enum scene_obj_flags_t { SCENEOF_SYNC_SIZE = BIT(5), SCENEOF_SYNC_WIDTH = BIT(6), SCENEOF_SYNC_BBOX = BIT(7), + SCENEOF_MANUAL = BIT(8), + + SCENEOF_LAST, /* check for size of flags below */ }; enum { @@ -361,12 +366,16 @@ struct scene_obj { struct scene_obj_dims dims; enum scene_obj_align horiz; enum scene_obj_align vert; - u8 flags; - u8 bit_length; + u16 flags; u16 start_bit; + u8 bit_length; struct list_head sibling; }; +/* Ensure the largest flag value fits in the flags field */ +_Static_assert(SCENEOF_LAST < BIT(sizeof(((struct scene_obj *)0)->flags) * 8), + "scene_obj flags exceed flags field capacity"); + /* object can be highlighted when moving around expo */ static inline bool scene_obj_can_highlight(const struct scene_obj *obj) { @@ -977,6 +986,20 @@ int scene_obj_set_valign(struct scene *scn, uint id, enum scene_obj_align aln); */ int scene_obj_set_hide(struct scene *scn, uint id, bool hide); +/** + * scene_obj_set_manual() - Set whether an object arranges its dependents + * + * When this is enabled, scene_arrange() will refrain from moving objects + * attached to this one. E.g. for a menu, normally it moves text objects + * associated with the menu. + * + * @scn: Scene to update + * @id: ID of object to update + * @manual: true to disable arrange dependents when this object is updated + * Returns: 0 if OK, -ENOENT if @id is invalid + */ +int scene_obj_set_manual(struct scene *scn, uint id, bool manual); + /** * scene_menu_set_title() - Set the title of a menu *