From patchwork Tue Dec 18 04:19:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 1014981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JlGF1qNHz9sC7 for ; Tue, 18 Dec 2018 15:21:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="kOlj/yAf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CDfzdP8x"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43JlGD6yZpzDq5Z for ; Tue, 18 Dec 2018 15:21:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="kOlj/yAf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CDfzdP8x"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="kOlj/yAf"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CDfzdP8x"; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43JlDd05hXzDqWs for ; Tue, 18 Dec 2018 15:20:17 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 9EEE522BF5; Mon, 17 Dec 2018 23:20:14 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 17 Dec 2018 23:20:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm1; bh=kCbpN6l3KkW6dHMxTNU6TtweZSLYqZxrTfiwtUeVtWk=; b=kOlj/ yAffr+HKVkR8owX7kbjIbHEDxmmzg4MtcGtYV9RDM5BV32rNcbHs+KRO3YjprHlV vUqfY0vt2SwcCgD0MWtu03lvD2l3WRWUBm0L7JVAcmnsTrTSH7kSR+aqdtURpgfq ZyShzxZNu7oeBQwrwgsSkAUX/hOMjlfTdCfkn6IZKQWsUpuwcVJPdH8ockacF593 WxWX2wUUJkNzvHyNJogZwL9Uu04in/fI77go/dGtNEsQO0lmZyXMyD8RlbqE+f8g NkNexSQMpJGF9qmiP+EFFqr5v5kZ5qgSFf8yQuMrdufPQPwuclJe4agKw69XuXHS 6tQ5rxbWY0l6sRJEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=kCbpN6l3KkW6dHMxTNU6TtweZSLYqZxrTfiwtUeVtWk=; b=CDfzdP8x JKeZ9GPf23bbfcC4QeUYSc46xe1E0+ktNfpsn7k3LMI0J4/Qm06BGaW1OLd35MQy khk3BN+sqSmLY5/OMRCl2iZNkXU8nL2HDQY+lXCTzY2JHLLqF6TmWJ35kmAJ+WgK RHgf7eimVWGdz0yExtv2jvJvjgsC2yEH9+XL9TB+rNK+AiKMVuLxRuuH4Lye9yzL flxocAfnoVgTlF8x9iy03Yo4PeGngL7I6PD3ZNcnkmdimTmZV36H+mUDLhbyqt2C YTPNQ7Mhc/XCIoetEhSDSQHRiyoLAztFA56MZFk7xUBxmiFXllvJeqGadtpSujac 58LevcxeiYALew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudeigedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpe furghmuhgvlhcuofgvnhguohiirgdqlfhonhgrshcuoehsrghmsehmvghnughoiigrjhho nhgrshdrtghomheqnecukfhppeduvddvrdelledrkedvrddutdenucfrrghrrghmpehmrg hilhhfrhhomhepshgrmhesmhgvnhguohiirghjohhnrghsrdgtohhmnecuvehluhhsthgv rhfuihiivgepge X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 37BC210084; Mon, 17 Dec 2018 23:20:12 -0500 (EST) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [RFC PATCH 7/8] ui/ncurses: Add current_field accessor Date: Tue, 18 Dec 2018 15:19:52 +1100 Message-Id: <20181218041953.8960-8-sam@mendozajonas.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181218041953.8960-1-sam@mendozajonas.com> References: <20181218041953.8960-1-sam@mendozajonas.com> MIME-Version: 1.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Signed-off-by: Samuel Mendoza-Jonas --- ui/ncurses/nc-widgets.c | 13 +++++++++++++ ui/ncurses/nc-widgets.h | 1 + 2 files changed, 14 insertions(+) diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c index afd56d71..86587bc8 100644 --- a/ui/ncurses/nc-widgets.c +++ b/ui/ncurses/nc-widgets.c @@ -1402,3 +1402,16 @@ int widget_focus_y(struct nc_widget *widget) return widget->focus_y; } +struct nc_widget *current_widget(struct nc_widgetset *set) +{ + FIELD *f; + + f = current_field(set->form); + + if (!f) { + pb_debug_fn("No field is selected!\n"); + return NULL; + } + + return field_userptr(f); +} diff --git a/ui/ncurses/nc-widgets.h b/ui/ncurses/nc-widgets.h index ce3b0386..88ca2125 100644 --- a/ui/ncurses/nc-widgets.h +++ b/ui/ncurses/nc-widgets.h @@ -90,6 +90,7 @@ int widget_width(struct nc_widget *widget); int widget_y(struct nc_widget *widget); int widget_x(struct nc_widget *widget); int widget_focus_y(struct nc_widget *widget); +struct nc_widget *current_widget(struct nc_widgetset *set); /* widgetset API */ typedef void (*widget_focus_cb)(struct nc_widget *widget, void *arg);