From patchwork Mon Oct 6 16:54:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 505 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=1759769716; bh=fL9hVuIJoamos4d17G6u5iPSCvK2Vsj5z1dQGamRiqI=; 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=ffi7yLkcbCYkVZceAiB0UgigAiNufBwZ23VjrtmDR/F8LYQlmzAWTOmgjb6ARwMFM 0XD+QuBTnpjD7HAHP45MR4Oh5iGUvx1gBdN7EKdjWCWvieBlz6WhGUwXcdLJxtECY4 kJMMq8H0grLDFyntEQM1MMZsJYQf8+3IfHBjPKCjAzK77J1DxGCWxTB+9s4NDzhFJe FrPe72G4ywsTDStM0rtlN17uEUHPmHTgKKyxwlmigJvaIVrm8ZukjvY7itg8c4Q41g ME+eFi4FmvtEEHCjPDEGFv9PDQdATV1/8AHzqqLXqHTnkObnrqsbbe6f6OeWXbtkbd l4emIfQdF9PVw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4AC9C67F8F for ; Mon, 6 Oct 2025 10:55:16 -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 hd1d7v31FwH3 for ; Mon, 6 Oct 2025 10:55:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769715; bh=fL9hVuIJoamos4d17G6u5iPSCvK2Vsj5z1dQGamRiqI=; 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=EPmRRcbB4CDyEi7BPjKRjb0tfuzDo0F5BzxgkATLyl9wK85HrE1LHqk0EQM83ZgL9 reDkydZ0j66W6JewDmqPh7PP0b+YDIkSUL3ZvcDU81HEfvo1mMhNIao6/6vFrm6rPE G/7eNQI3TEJLejmjmymnBCgDvg8YgDbUisRLLYl+VpQNwTWWBYvTRT+g8BPXVX7gtG FYME2eMcwR7hT3Nn6/837UfeTSLE2RhMRMiE/i5sWqIE+01FGLXhVpCToxcSwRudWp sLt7p9eBjJC9QuOSFGgdMhvh1Pri/KbdpZ/iCihRQRvxCNM6MxxA6b6DMP5Q7yOlBe iRassbNQ4MLXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2085667FB7 for ; Mon, 6 Oct 2025 10:55:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769710; bh=JQC8A2uTAT4WcnZXFjaCpdgEoRE4+DpUszxPZWoIrJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmIbrFJuLd4BUuCmghT0WqKzTSt6tkGiwOkrMCfJyFxvtfQ1QN3SXJVq8HPoy6O82 7YOMcTtZO9fcRxDquV8ZasYjGZQe9w5QRjLCd2V8MRRaTuWD9Z2i6uES1Rsy4JA7JC YhRPFvS3a+UYluzlTqGtMRGOsgvVXuhQzpEXU5dLPpPZzpLITAOMgmPJNAPi6lzt6t xQoOE8phbr1kWeQ+uv78Qutx90ylMkT6hJCL2K99CbquTQEgrIutQSdxcoF4q4X8UQ LTEjB/tXgAxm8eeNsx+5pPO3Cm/aAbFZsr82S8aEJr47oM/BiJh3u7SnXcIDxYsSrE UmgLRl1LWlKcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D4EC567F09; Mon, 6 Oct 2025 10:55:10 -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 OwdhHHRLybh1; Mon, 6 Oct 2025 10:55:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769710; bh=QNlF0lCJtpPkZgND5bLnN4Hdrjd6bG0ZI3hPw8jXPmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2wS1OxbxZq+D3izHh7std4RG+pbJkt57O1EAa/mi0VWWMMFiQUVDVRWTQrHbqw1H XuWLTEp1ac+wdur8mPvIRHDvQWyZhOjofzZNloI0j7Aq0YR2mdVMOtUcfC2Z/RiFLg 9/m2stNdbRFzIBmdxXJWdW5CUnGEgUjlQJyFjWnscfVTW7yUBVvkLV3dIxk7/dEwsS ifxdC6GJt0m3BUoD4BjVmtTq4DguPKmc7ZKyokhVcML4BJAO8jfPOw6glrhj02hfGl Hlp3GQdy22Ezbo50/hSlUSJ6TwLWjFZVkuxxxXByXAe3CP01iVLbVmE+Qvp6sS3zwu lHL1qF9U1Z09w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4585267ECE; Mon, 6 Oct 2025 10:55:10 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:34 -0600 Message-ID: <20251006165452.1675349-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251006165452.1675349-1-sjg@u-boot.org> References: <20251006165452.1675349-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JXQPT477Y6CAPOL22LOVRKI3YFBIGU4V X-Message-ID-Hash: JXQPT477Y6CAPOL22LOVRKI3YFBIGU4V 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/14] mouse: Use struct vid_pos for click position 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 Use the new vid_pos struct instead of separate x/y fields. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/input/mouse-uclass.c | 8 ++++---- include/mouse.h | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index 256642ef55e..0e5faccf1e2 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -44,8 +44,8 @@ int mouse_get_click(struct udevice *dev, int *xp, int *yp) if (uc_priv->left_button_state == BUTTON_PRESSED && new_state == BUTTON_RELEASED) { pending = true; - uc_priv->click_x = event.button.x; - uc_priv->click_y = event.button.y; + uc_priv->click_pos.x = event.button.x; + uc_priv->click_pos.y = event.button.y; } /* Update button state */ @@ -54,9 +54,9 @@ int mouse_get_click(struct udevice *dev, int *xp, int *yp) /* If we just detected a click, return it */ if (pending) { if (xp) - *xp = uc_priv->click_x; + *xp = uc_priv->click_pos.x; if (yp) - *yp = uc_priv->click_y; + *yp = uc_priv->click_pos.y; return 0; } diff --git a/include/mouse.h b/include/mouse.h index 0d20f8ffdbc..8e65ac79b94 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -9,6 +9,7 @@ #define _MOUSE_H #include +#include struct udevice; @@ -35,13 +36,11 @@ enum mouse_press_state_t { * struct mouse_uc_priv - private data for mouse uclass * * @left_button_state: Current state of left button (BUTTON_PRESSED/BUTTON_RELEASED) - * @click_x: X coordinate where the click occurred - * @click_y: Y coordinate where the click occurred + * @click_pos: Position where the click occurred */ struct mouse_uc_priv { enum mouse_press_state_t left_button_state; - int click_x; - int click_y; + struct vid_pos click_pos; }; /**