From patchwork Mon Sep 15 12:28:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 330 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=1757939417; bh=1DslM/rg0lPS9PXSgNFYYMVaUIUmo1dphEPh3UQoVRc=; 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=FMnKo8ON4Ra6qqxU6RTGp1g43MlT9F6Y9hy+ZrrnPFp7zVx6K36F7gLmq4ykv9cvX 3lYlCmnuGhZNzIk0/yV1wBMN3qTQfERe7zTzwkTnuA2aFbmEOl5tOgQHJu8+i4GCV9 lZOpjZn6NojaIfHdFeZOHoS0prXb8yZetkTQ/ZQp2WRYJj/nxeP8hffskmqnyqcNH7 NJ6Tv950tG6Rr61V4pHo/qyVjCXOYfPkEB5RqGcELTpzlGiHcNaBuxNuygHGkmkFxn K6nDlqiyyFFc3sZ1NNy/2yTi39tRQpPQ9H6jHmPef+De7qw/rG1UXXXoF8YH9hf7F4 7o85GdIcAfExQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 77D2467BD4 for ; Mon, 15 Sep 2025 06:30:17 -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 LL8vkpCOIMTs for ; Mon, 15 Sep 2025 06:30:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939417; bh=1DslM/rg0lPS9PXSgNFYYMVaUIUmo1dphEPh3UQoVRc=; 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=FMnKo8ON4Ra6qqxU6RTGp1g43MlT9F6Y9hy+ZrrnPFp7zVx6K36F7gLmq4ykv9cvX 3lYlCmnuGhZNzIk0/yV1wBMN3qTQfERe7zTzwkTnuA2aFbmEOl5tOgQHJu8+i4GCV9 lZOpjZn6NojaIfHdFeZOHoS0prXb8yZetkTQ/ZQp2WRYJj/nxeP8hffskmqnyqcNH7 NJ6Tv950tG6Rr61V4pHo/qyVjCXOYfPkEB5RqGcELTpzlGiHcNaBuxNuygHGkmkFxn K6nDlqiyyFFc3sZ1NNy/2yTi39tRQpPQ9H6jHmPef+De7qw/rG1UXXXoF8YH9hf7F4 7o85GdIcAfExQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6349F67BAC for ; Mon, 15 Sep 2025 06:30:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939415; bh=1J9p6wZcZm66ppMJZjt+MxcsJ0LHdNePTBGFj/yyclI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QJcnqWib93HMA/Sk4xQqLQZF4/CX//ea3Wua8pTjYegzNA0R42aFCAC51NzxlU4cc 931lT8IFx7KWcruq2GJ6fvc2fkIORE4SyGhCigqhWz6h8zJhrK/D4fTDmBXctuS0g/ GO4tx3SfwqS4YTi4zD2kVem8azSAQ81DOpTo3rpU8Ak3oN/DL3QfvkduaQ6bfWogqV aCrCDvzSWi36u2hJcyGdcSSg9O7ct5wiFxc5RMzrF7zDKFYIJRI8G4trqAusTIdr/n DPRHPgbjy952qdecLgs5J6hCoFS5i1Bdq4wAiuGbS9puOnB2FKZ6ra7O+ovFhZSQG7 moWqZ/Zuf8Uyg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6132567BAC; Mon, 15 Sep 2025 06:30:15 -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 npgWwoQgoe1r; Mon, 15 Sep 2025 06:30:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939411; bh=cWIWx468NMeHB0c9qYqsfZEExLV1X4a6qZaZHmaTUv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZN1sIf5GT5WzoIGHaW6uxhOD2PrWwkoG1q4OUihqn4aNEuYYtyuAyDeQ5skvS4cf dyfes7HoOXUD4p7/xh2iGifHO09+r7+NogHddBsGTcS/znAajaYo8JaN83BolnR3g3 wB98gfw0PyZLb3322HTHmdIOVFA/A2L/bHbb8BmZrMEIwxQ0L4dtGmWIOvuES3ppc1 QfA91uLsBSLo6q7UajnISbp5vcfzNiiaeIZbeANUFYCOu9JZrmmiaUUvNs+HWUW+dW Xi3p4aphacH6C7U0rB4fwOlehIVAdQmfohFNcMgUaAFN1371FQj4FLJxhKZC1jmaK9 A8aoJfXebpM4Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 10DF567B3C; Mon, 15 Sep 2025 06:30:11 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 15 Sep 2025 06:28:48 -0600 Message-ID: <20250915122905.1217249-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915122905.1217249-1-sjg@u-boot.org> References: <20250915122905.1217249-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2UKFNRIE4AJ5SLFNHAFZ32TJEM7USGDD X-Message-ID-Hash: 2UKFNRIE4AJ5SLFNHAFZ32TJEM7USGDD 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 15/23] expo: Support sending a click to a menu 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 Clicking on a menu can result in selecting an item. If it is a popup menu then the item should be closed. Add support for this. Signed-off-by: Simon Glass --- boot/scene_internal.h | 13 +++++++++++++ boot/scene_menu.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 03bc925edfe..91828538417 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -184,6 +184,19 @@ int scene_apply_theme(struct scene *scn, struct expo_theme *theme); int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key, struct expo_action *event); +/** + * scene_menu_send_click() - Send a click to a menu for processing + * + * @scn: Scene to use + * @menu: Menu to use + * @x: X coordinate of click + * @y: Y coordinate of click + * @event: Place to put any event which is generated by the click + * Returns: 0 if OK, -ENOTTY if there is no menu item at that position + */ +int scene_menu_send_click(struct scene *scn, struct scene_obj_menu *menu, int x, + int y, struct expo_action *event); + /** * scene_textline_send_key() - Send a key to a textline for processing * diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 758343fe909..d54b99979e1 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -528,6 +528,36 @@ struct scene_menitem *scene_menu_within(const struct scene *scn, return NULL; } +int scene_menu_send_click(struct scene *scn, struct scene_obj_menu *menu, int x, + int y, struct expo_action *event) +{ + struct scene_menitem *item; + + if (scn->expo->popup) + assert(menu->obj.flags & SCENEOF_OPEN); + + log_debug("menu %d '%s': x %d y %d\n", menu->obj.id, menu->obj.name, + x, y); + + item = scene_menu_within(scn, menu, x, y); + if (!item) { + log_debug("not found\n"); + return -ENOTTY; + } + + if (scn->expo->popup) { + assert(menu->obj.flags & SCENEOF_OPEN); + /* Menu is open - point to item and close menu */ + event->type = EXPOACT_POINT_CLOSE; + log_debug("point-close item %d\n", item->id); + } else { + event->type = EXPOACT_SELECT; + log_debug("select item %d\n", item->id); + } + event->select.id = item->id; + return 0; +} + int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id, uint key_id, uint label_id, uint desc_id, uint preview_id, uint flags, struct scene_menitem **itemp)