Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4039624rdb; Thu, 28 Dec 2023 08:10:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGreZZI9xEksAibznyNDn+xcLSRySXa5lgSmzWGULlnlNh0LNCuG3N+r2+8ZpBbS//1xwUL X-Received: by 2002:a1f:c683:0:b0:4b6:c9fa:d8e0 with SMTP id w125-20020a1fc683000000b004b6c9fad8e0mr5224574vkf.15.1703779842966; Thu, 28 Dec 2023 08:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703779842; cv=none; d=google.com; s=arc-20160816; b=dgxTxCSF9ANUmALcR1DBdFnvWo9l4bp1F+eHauhPyprnsKECHXzEMZqSUwWV35GRXU 12jSzg+WXDyB81Lewt0foRP3dApUM5CMcxiNeGSOZoyypmTMlvuE8pA4bj03TYf24P88 8HpuegY4i9slwwxgdpauSch6tDmL/ZR3HzKKX37TWCgrsHjN1DPxHPzzooEWqYhUUacL 7hDPPfd5HLg6G0XHvdtqcOFRBjDB4dgMxobh7RfsgIFnMDEJxF0quBQXLbTcYj9NTxmY zZMCK+4gUsBiZGNbMdi0/Ab1U4kEnwL/9rHxsJKTvls+2purnbiSzQyu2sLxC35VnbHN ODqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=R9YDzFFKMJPBsP+nxBdmatVm/w8MqjhSixGm8+GCE6Q=; fh=sxscVsdojCsQiAtZF2+fCcUqexc2QCBgNxiEk83mwHU=; b=0i8GmXYctY6kDgbzrNUwUthuRzUvaBpRQuIk23p+Xk3EqF/PWcI/jXVKOOcuZgBrSM hDPuSJbBPd5pFscSzUMfvRcubAvkDfw9kDnPZDsRt6q3MIZQ/N3dIbYTD4ZG3QhH9QvG Eefuqaewgi5UxS473zC+lB+98CyhEfU1Z64yf4/CW1b7MHyFMx8nYiSVPJi34iawdqwJ ImKwSuSdtzIPa55kO4yRiK5MvREp48/BJH7Ff0myYFMbf/+cO7ufZlnyWo4Bygbrozfh px24b2z1Y6ITDHy0zsJmnax0K1bZw4EvoRneE/swT0ho+7jYDHNY3JNgbPfXhDvSyHX4 ULZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZVmE1+jM; spf=pass (google.com: domain of linux-kernel+bounces-12770-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12770-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ff21-20020a0561224c1500b004b6d962d86bsi1976788vkb.57.2023.12.28.08.10.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 08:10:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12770-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZVmE1+jM; spf=pass (google.com: domain of linux-kernel+bounces-12770-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12770-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9D6CA1C20F73 for ; Thu, 28 Dec 2023 16:10:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC267F50E; Thu, 28 Dec 2023 16:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZVmE1+jM" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AB23883B; Thu, 28 Dec 2023 16:10:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B8CCC433C7; Thu, 28 Dec 2023 16:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703779834; bh=RSdLfk9wXN3UmWbB+4Xg5vcj5ybypng0lAuXAXAnXew=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZVmE1+jMMvEws3muVa7Wz7O+CrtmRIQ17orpjAKcheuw2zxLBWv7jMkHCsHnLVzgp YqZAFhb93nthI/i5zyZhKLTQ+oBNd+3AXX/MyuVo6geIKeQC6ax2+ZMgTe6I3TXRPl hnqBWA3a6tcZMUINOCGLlczYZVfW2KcxTfZMU74WeRtAu2jmsfSCVcQFKSe/56x46j sxjHCAOlITH1aXL5HKJ4hPCgfet/apXQS/d6wDjZhfBE/d+BF+lrsOUasBAq3Hw9wu 9SmAbp6XvUWsvjzxr/PGF4KbdSNkv4UhfIEGK6C4jUoWdKtCbt+MagUhztwxAtB01Q ePcd2Gp6uF0MQ== Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-203fbbff863so2649840fac.0; Thu, 28 Dec 2023 08:10:34 -0800 (PST) X-Gm-Message-State: AOJu0YxCG7T2JIc9Y4aM7BUZg+HH2tZ7/a1ozb5/FP3qA037i4nXgSuq qR1F7f2BudFepRdh24JJLmWi8W5P916hHwuBfjE= X-Received: by 2002:a05:6871:3a2c:b0:1fa:f432:22d with SMTP id pu44-20020a0568713a2c00b001faf432022dmr3851410oac.17.1703779833901; Thu, 28 Dec 2023 08:10:33 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231228054630.3595093-1-tfiga@chromium.org> In-Reply-To: <20231228054630.3595093-1-tfiga@chromium.org> From: Masahiro Yamada Date: Fri, 29 Dec 2023 01:09:57 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kconfig: menuconfig: Make hidden options show as dim To: Tomasz Figa Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Jesse Taube Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 28, 2023 at 2:46=E2=80=AFPM Tomasz Figa wr= ote: > > When hidden options are toggled on (using 'z'), the number of options > on the screen can be overwhelming and may make it hard to distinguish > between available and hidden ones. Make them easier to distinguish by > displaying the hidden one as dim (using the A_DIM curses attribute). > > Signed-off-by: Tomasz Figa Do you think this is useful? This changes the color only when you select a hidden item. For unselected items, you cannot distinguish hidden ones, as A_DIM has no effect to black text. > --- > scripts/kconfig/lxdialog/dialog.h | 3 +++ > scripts/kconfig/lxdialog/menubox.c | 11 +++++++---- > scripts/kconfig/lxdialog/util.c | 10 ++++++++++ > scripts/kconfig/mconf.c | 18 ++++++++++++++++++ > 4 files changed, 38 insertions(+), 4 deletions(-) > > diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog= /dialog.h > index a501abf9fa31..d2ebdc6e2e28 100644 > --- a/scripts/kconfig/lxdialog/dialog.h > +++ b/scripts/kconfig/lxdialog/dialog.h > @@ -128,6 +128,7 @@ void item_add_str(const char *fmt, ...); > void item_set_tag(char tag); > void item_set_data(void *p); > void item_set_selected(int val); > +void item_set_hidden(int val); > int item_activate_selected(void); > void *item_data(void); > char item_tag(void); > @@ -139,6 +140,7 @@ struct dialog_item { > char tag; > void *data; /* pointer to menu item - used by menubox+checkli= st */ > int selected; /* Set to 1 by dialog_*() function if selected. *= / > + int hidden; /* Set to 1 if hidden. */ > }; > > /* list of lialog_items */ > @@ -157,6 +159,7 @@ int item_n(void); > const char *item_str(void); > int item_is_selected(void); > int item_is_tag(char tag); > +int item_is_hidden(void); > #define item_foreach() \ > for (item_cur =3D item_head ? item_head: item_cur; \ > item_cur && (item_cur !=3D &item_nil); item_cur =3D item_cur= ->next) > diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialo= g/menubox.c > index 0e333284e947..2cf1f24f67b6 100644 > --- a/scripts/kconfig/lxdialog/menubox.c > +++ b/scripts/kconfig/lxdialog/menubox.c > @@ -51,9 +51,9 @@ static int menu_width, item_x; > * Print menu item > */ > static void do_print_item(WINDOW * win, const char *item, int line_y, > - int selected, int hotkey) > + int selected, int hotkey, int hidden) > { > - int j; > + int j, attrs; > char *menu_item =3D malloc(menu_width + 1); > > strncpy(menu_item, item, menu_width - item_x); > @@ -64,7 +64,10 @@ static void do_print_item(WINDOW * win, const char *it= em, int line_y, > wattrset(win, dlg.menubox.atr); > wmove(win, line_y, 0); > wclrtoeol(win); > - wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); > + attrs =3D selected ? dlg.item_selected.atr : dlg.item.atr; > + if (hidden) > + attrs |=3D A_DIM; > + wattrset(win, attrs); > mvwaddstr(win, line_y, item_x, menu_item); > if (hotkey) { > wattrset(win, selected ? dlg.tag_key_selected.atr > @@ -81,7 +84,7 @@ static void do_print_item(WINDOW * win, const char *ite= m, int line_y, > #define print_item(index, choice, selected) \ > do { \ > item_set(index); \ > - do_print_item(menu, item_str(), choice, selected, !item_is_tag(':= ')); \ > + do_print_item(menu, item_str(), choice, selected, !item_is_tag(':= '), item_is_hidden()); \ > } while (0) > > /* > diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/u= til.c > index 3f78fb265136..58d6ee96f7ec 100644 > --- a/scripts/kconfig/lxdialog/util.c > +++ b/scripts/kconfig/lxdialog/util.c > @@ -635,6 +635,11 @@ void item_set_selected(int val) > item_cur->node.selected =3D val; > } > > +void item_set_hidden(int val) > +{ > + item_cur->node.hidden =3D val; > +} > + > int item_activate_selected(void) > { > item_foreach() > @@ -698,3 +703,8 @@ int item_is_tag(char tag) > { > return (item_cur->node.tag =3D=3D tag); > } > + > +int item_is_hidden(void) > +{ > + return (item_cur->node.hidden !=3D 0); > +} > diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c > index eccc87a441e7..090121a1e5b6 100644 > --- a/scripts/kconfig/mconf.c > +++ b/scripts/kconfig/mconf.c > @@ -539,6 +539,8 @@ static void build_conf(struct menu *menu) > menu_is_empty(menu) ? "= ----" : "--->"); > item_set_tag('m'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > if (single_menu_mode && menu->data) > goto conf_childs; > return; > @@ -548,6 +550,8 @@ static void build_conf(struct menu *menu) > item_make(" %*c*** %s ***", ind= ent + 1, ' ', prompt); > item_set_tag(':'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > } > break; > default: > @@ -556,6 +560,8 @@ static void build_conf(struct menu *menu) > item_make("---%*c%s", indent + 1,= ' ', prompt); > item_set_tag(':'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > } > } > } else > @@ -591,10 +597,14 @@ static void build_conf(struct menu *menu) > } > item_set_tag('t'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > } else { > item_make(" "); > item_set_tag(def_menu ? 't' : ':'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > } > > item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(me= nu)); > @@ -615,6 +625,8 @@ static void build_conf(struct menu *menu) > item_make("---%*c%s", indent + 1, ' ', menu_get_p= rompt(menu)); > item_set_tag(':'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > goto conf_childs; > } > child_count++; > @@ -632,6 +644,8 @@ static void build_conf(struct menu *menu) > item_make("-%c-", val =3D=3D no ?= ' ' : '*'); > item_set_tag('t'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > break; > case S_TRISTATE: > switch (val) { > @@ -648,6 +662,8 @@ static void build_conf(struct menu *menu) > item_make("-%c-", ch); > item_set_tag('t'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > break; > default: > tmp =3D 2 + strlen(sym_get_string_value(s= ym)); /* () =3D 2 */ > @@ -660,6 +676,8 @@ static void build_conf(struct menu *menu) > "" : " (NEW)"); > item_set_tag('s'); > item_set_data(menu); > + if (!visible) > + item_set_hidden(TRUE); > goto conf_childs; > } > } > -- > 2.43.0.472.g3155946c3a-goog > > --=20 Best Regards Masahiro Yamada